Problem with transparent background using Inkscape SVG icons in Qt
-
X-Post on reddit r/Inkscape
Hello,
I have a logo in SVG format (left in this picture) created with Inkscape. I can confirm that the background in the original file ins transparent. The background works fine when using this icon for a desktop shortcut in XFCE (a GNU/Linux desktop environment).
But when using that file as an icon in a Qt (Python with PyQt6) application the background is black. So it seems to be that Qt is the cause. But as you can see on that picture other SVG icons (xarchiver.svg) with transparent background working fine.

So I am assuming that Qt is not very tallented in interpreting SVG files. But an SVG file can be constructed in a way that even Qt can use it.
Does anyone of you have experience with that and know what to do with such an SVG file to make it proper for being used in Qt applications?
Checking the SVG source of xarchiver.svg it seems even this was created with Inkscape (~19 years ago).
I am aware of several in code manipulations to allow make the background transparent after importing the SVG file into Qt. But this are workarounds only. I would prefer to have a proper SVG file that can be handled by Qt without manipulating it. The xarchiver logo proofs that it must somehow be possible to create an SVG logo that can be handled by Qt.
Regards,
Christian -
X-Post on reddit r/Inkscape
Hello,
I have a logo in SVG format (left in this picture) created with Inkscape. I can confirm that the background in the original file ins transparent. The background works fine when using this icon for a desktop shortcut in XFCE (a GNU/Linux desktop environment).
But when using that file as an icon in a Qt (Python with PyQt6) application the background is black. So it seems to be that Qt is the cause. But as you can see on that picture other SVG icons (xarchiver.svg) with transparent background working fine.

So I am assuming that Qt is not very tallented in interpreting SVG files. But an SVG file can be constructed in a way that even Qt can use it.
Does anyone of you have experience with that and know what to do with such an SVG file to make it proper for being used in Qt applications?
Checking the SVG source of xarchiver.svg it seems even this was created with Inkscape (~19 years ago).
I am aware of several in code manipulations to allow make the background transparent after importing the SVG file into Qt. But this are workarounds only. I would prefer to have a proper SVG file that can be handled by Qt without manipulating it. The xarchiver logo proofs that it must somehow be possible to create an SVG logo that can be handled by Qt.
Regards,
Christian@buhtz You can see here what is supported by Qt: https://doc.qt.io/qt-6/svgextensions.html