Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8169057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T20:43:51+00:00 2026-06-06T20:43:51+00:00

I try to render embedded svg file using QSvgWidget. My file front.svg looks like

  • 0

I try to render embedded svg file using QSvgWidget. My file “front.svg” looks like this:

<svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" width="500" height="500" id="svgfile">
<rect style="fill:#ff0000;" id="rect1" width="150" height="200"/>

<svg x="100" y="100">
    <rect style="fill:#00ff00;" id="rect2" width="200" height="120"/>
</svg>
</svg>

This file looks quite normal in Chrome, or Inkscape, but in svgwidget it looks strange. Only green rectangle is visible, and red is very small, and hidden behind the green one.
Here is my python code:

import sys
from PySide.QtGui import QApplication
from PySide.QtSvg import QSvgWidget

if __name__ == '__main__':
    app = QApplication(sys.argv)

    widget = QSvgWidget('front.svg')
    widget.show()

    sys.exit(app.exec_())

Does anybody knows, whether I do something wrong, or is it some bug in PySide?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T20:43:53+00:00Added an answer on June 6, 2026 at 8:43 pm

    I found some workaround to this issue. Now I’m using QGraphicsWebView instead of QSvgWidget. Here is my Python code (svg file remains unchanged):

    import sys
    from PySide.QtGui import QApplication, QGraphicsScene, QGraphicsView
    from PySide.QtWebKit import QGraphicsWebView
    
    if __name__ == '__main__':
        app = QApplication(sys.argv)
    
        item = QGraphicsWebView()
        item.load('front.svg')
        view = QGraphicsView()
        scene = QGraphicsScene()
        scene.addItem(item)
        view.setScene(scene)
        view.show()
        sys.exit(app.exec_())
    

    It’s strange, that QT renders svg files correctly with this widget, and totally wrong using dedicated widget (I also had problems with “text” elements).
    But now everything works fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When i try to render this svg sample, the line is bluring automatically and
I load obj models and try to render them with OpenGL ES using Android
So I have this div <div id=result_text></div> And I try doing render :update do
when I try to render the view, browser show this error 01:46:11,371 GRAVE [javax.enterprise.resource.webcontainer.jsf.application]
I find this problem when I try to render multiple textures in a 3D
From this example http://www.smartclient.com/smartgwt/showcase/#tree_databinding_local , I started to implement my own tree structure dynamically
I'm developing on an embedded device using OpenWRT. Whenever I try to use fswebcam
I want to render a .phtml file through Apache, however when I try, it
I have a mvc web project where I try to render a list of
I defined a composite component (actually a few) and when I try to re-render

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.