[QGIS-Developer] SVG toolbar icons suddenly appearing in black

Nyall Dawson nyall.dawson at gmail.com
Thu Sep 23 19:25:55 PDT 2021


On Thu, 23 Sept 2021 at 19:26, Raymond Nijssen <r.nijssen at terglobo.nl> wrote:
>
> Hi devs!
>
> The dark blue icons on my plugin toolbar buttons are black for some of
> my customers (on Windows). One of them mentioned that they turned black
> after a QGIS update. On my Linux system they are still blue. I guess it
> has to do with Qt.

Hi Raymond,

I've seen this in the past. Seems that Qt on windows is more sensitive
to SVG structure vs other platforms! In the past I've had luck by
optimising the svg with https://jakearchibald.github.io/svgomg/  ,
which seems to make Qt happier... (Turn off "Round/rewrite numbers"
option though, cos that makes Qt LESS happy!)

Nyall


>
>
>
> Here's the content of the svg file:
>
> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
>    <defs>
>      <style>
>        .a {
>          fill: #1b3d6e;
>        }
>      </style>
>    </defs>
>    <path class="a"
> d="M15.52,6.54a7.29,7.29,0,0,0-1.77,7.38l-9.9,9.9-.34,4.33,5.94-.6v-2.8h2.8V22h2.8l3.37-3.36a7.26,7.26,0,1,0-2.9-12Zm5.37,2.1a2,2,0,1,1,0,2.81A2,2,0,0,1,20.89,8.64Z"/>
> </svg>
>
>
>
> And here's how I make the buttons:
>
> icon_fn = os.path.join(self.plugin_dir, 'img', 'icon_configuration.svg')
> icon = QIcon(icon_fn)
> action = QAction(icon, 'Configure', self.iface.mainWindow())
> self.toolbar.addAction(action)
>
>
>
>
> Hope anyone can clarify. The svg files were made by a designer, I guess
> in some Adobe application. Hope I don't need adjusting them.
>
> Kind regards,
> Raymond
>
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


More information about the QGIS-Developer mailing list