]> git.lyx.org Git - features.git/commitdiff
Adjust selection color of delimiter icons
authorJuergen Spitzmueller <spitz@lyx.org>
Sun, 7 Feb 2021 11:32:11 +0000 (12:32 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Sun, 7 Feb 2021 11:32:11 +0000 (12:32 +0100)
src/frontends/qt/GuiDelimiter.cpp

index 9043974785f3f2cbb72686c8b706f3e5d86042b1..5b238040733e6095dfc22d3a5cafd07e852b7f88 100644 (file)
@@ -90,21 +90,27 @@ struct MathSymbol {
 };
 
 
 };
 
 
-QPixmap getSelectedPixmap(QPixmap pixmap)
+QPixmap getSelectedPixmap(QPixmap pixmap, QSize const icon_size)
 {
        QPalette palette = QPalette();
        QColor text_color = (guiApp->isInDarkMode())
                        ? palette.color(QPalette::Active, QPalette::WindowText)
                        : Qt::black;
        QColor highlight_color = palette.color(QPalette::Active, QPalette::HighlightedText);
 {
        QPalette palette = QPalette();
        QColor text_color = (guiApp->isInDarkMode())
                        ? palette.color(QPalette::Active, QPalette::WindowText)
                        : Qt::black;
        QColor highlight_color = palette.color(QPalette::Active, QPalette::HighlightedText);
+       QColor highlight_bg = palette.color(QPalette::Active, QPalette::Highlight);
 
        // create a layer with black text turned to QPalette::HighlightedText
        QPixmap hl_overlay(pixmap.size());
        hl_overlay.fill(highlight_color);
        hl_overlay.setMask(pixmap.createMaskFromColor(text_color, Qt::MaskOutColor));
 
 
        // create a layer with black text turned to QPalette::HighlightedText
        QPixmap hl_overlay(pixmap.size());
        hl_overlay.fill(highlight_color);
        hl_overlay.setMask(pixmap.createMaskFromColor(text_color, Qt::MaskOutColor));
 
+       // Create highlighted background
+       QPixmap hl_background(icon_size);
+       hl_background.fill(highlight_bg);
+
        // put layers on top of existing pixmap
        QPainter painter(&pixmap);
        // put layers on top of existing pixmap
        QPainter painter(&pixmap);
+       painter.drawPixmap(pixmap.rect(), hl_background);
        painter.drawPixmap(pixmap.rect(), hl_overlay);
 
        return pixmap;
        painter.drawPixmap(pixmap.rect(), hl_overlay);
 
        return pixmap;
@@ -240,7 +246,7 @@ GuiDelimiter::GuiDelimiter(GuiView & lv)
                // get pixmap with bullets
                QPixmap pixmap = getPixmap("images/math/", toqstr(ms.icon), "svgz,png");
                QIcon icon(pixmap);
                // get pixmap with bullets
                QPixmap pixmap = getPixmap("images/math/", toqstr(ms.icon), "svgz,png");
                QIcon icon(pixmap);
-               icon.addPixmap(getSelectedPixmap(pixmap), QIcon::Selected);
+               icon.addPixmap(getSelectedPixmap(pixmap, icon_size), QIcon::Selected);
                QListWidgetItem * lwi = new QListWidgetItem(icon, QString());
                setDelimiterName(lwi, delim);
                left_list_items_[ms.unicode] = lwi;
                QListWidgetItem * lwi = new QListWidgetItem(icon, QString());
                setDelimiterName(lwi, delim);
                left_list_items_[ms.unicode] = lwi;