commit 7ba06e8812842c1d2bf22179f86823954da99e11
Author: Juergen Spitzmueller <[email protected]>
Date:   Wed Mar 12 08:15:34 2025 +0100

    Fix pen color in getScaledPixmap
    
    This generated wrong pixmaps in dark mode
---
 src/frontends/qt/GuiApplication.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/frontends/qt/GuiApplication.cpp 
b/src/frontends/qt/GuiApplication.cpp
index 30ef114123..0cf0419536 100644
--- a/src/frontends/qt/GuiApplication.cpp
+++ b/src/frontends/qt/GuiApplication.cpp
@@ -2680,6 +2680,7 @@ QPixmap GuiApplication::getScaledPixmap(QString imagedir, 
QString name) const
        // We render SVG directly for HiDPI scalability
        QPixmap pm = getPixmap(imagedir, name, "svgz,png");
        FileName fname = imageLibFileSearch(imagedir, name, "svgz,png");
+       bool const dark_mode = theGuiApp() ? theGuiApp()->isInDarkMode() : 
false;
        QString fpath = toqstr(fname.absFileName());
        if (!fpath.isEmpty() && !fpath.endsWith(".png")) {
                QSvgRenderer svgRenderer(fpath);
@@ -2688,6 +2689,10 @@ QPixmap GuiApplication::getScaledPixmap(QString 
imagedir, QString name) const
                        pm.fill(Qt::transparent);
                        QPainter painter(&pm);
                        svgRenderer.render(&painter);
+                       
painter.setCompositionMode(QPainter::CompositionMode_SourceIn);
+                       QColor const penColor = dark_mode ? Qt::lightGray : 
Qt::darkGray;
+                       painter.fillRect(pm.rect(), penColor);
+                       painter.end();
                        pm.setDevicePixelRatio(dpr);
                }
        }
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to