Skip to content

Commit

Permalink
using transparent backgrounds for svg drawing fails under light or dark
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinhendricks committed Dec 11, 2023
1 parent 88d1036 commit 1dea25f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Misc/Utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1541,8 +1541,10 @@ QImage Utility::RenderSvgToImage(const QString& filepath)
renderer.load(svgdata.toUtf8());
QSize sz = renderer.defaultSize();
QImage svgimage(sz, QImage::Format_ARGB32);
// **must** fill it with tranparent pixels BEFORE trying to render anything
svgimage.fill(qRgba(0,0,0,0));
// **must** fill it with pixels BEFORE trying to render anything
// transparent fill will not work with light and dark modes: svgimage.fill(qRgba(0,0,0,0));
svgimage.fill(QColor("white"));
// was svgimage.fill(qRgba(0,0,0,0));
QPainter painter(&svgimage);
renderer.render(&painter);
return svgimage;
Expand Down

0 comments on commit 1dea25f

Please sign in to comment.