0


well I'm trying to use svgs for the QTreeView widget. I'm doing this with a simple stylesheet and was wondering if it is supported after i found nothing on the internet.

QTreeView::branch:open:has-children:!has-siblings,
QTreeView::branch:open:has-children:has-siblings  {
border-image: none;
image: url(C:/..../folder.svg);
width: 19px;
height: 16px;
margin: 2px 0px 2px 4px;
}


Problem is the svg is not showing.

Edit:
Heres the svg: https://drive.google.com/file/d/0B9JmnAJW15XqcTc0TS1HNk80N0E/view?usp=sharing

semic
  • 29
  • 2
  • Yes, svg images are supported. Are you absolutely certain that the url is valid? Try the same path with a jpg. Also: what specific version of Qt and PySide are you using? – ekhumoro Feb 16 '16 at 19:12
  • Yes the Path is valid. The PySide.__version__ says: 1.1.2. The QtCore.__version__ is: 4.8.2 – semic Feb 17 '16 at 06:10
  • Well, i updated to the pyside version 1.2.4 and qtcore is now 4.8.7. Still giving me a blank icon. – semic Feb 17 '16 at 06:18
  • I tested with your svg image and was able to get it to work on Linux. Did you check that the same code works with a jpg image? – ekhumoro Feb 17 '16 at 23:51
  • Yes, I also have a folder.png in this directory. The png works like a charm but the folder.svg is not showing. I'm on windows 7... – semic Feb 18 '16 at 10:29
  • If you do a websearch on `qt svg plugin windows` you will get quite a lot of hits on this issue. The problem seems to be that the plugins path is not configured properly, and so the svg plugin is not found. – ekhumoro Feb 18 '16 at 18:50
  • In my case, trying to create a `QPixmap` from an `svg` file in pyside 1.2.4, the problem was solved by adding an import statement (without even using the imports), based on [this SO answer](https://stackoverflow.com/a/13531623): `from PySide import QtSvg, QtXml` – djvg Apr 05 '19 at 06:36

0 Answers0