From 19ea0f625c49f76569d0c899d47d6057a07edb45 Mon Sep 17 00:00:00 2001 From: Alfredo Monclus Date: Mon, 3 Mar 2025 11:21:44 -0300 Subject: [PATCH] revert: icon to manually painted one windows icon is very different let's try to keep the look unified --- .../QSint/actionpanel/actionpanelscheme.cpp | 47 ++++++++++++++----- 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/src/Gui/QSint/actionpanel/actionpanelscheme.cpp b/src/Gui/QSint/actionpanel/actionpanelscheme.cpp index e8ecfe6e34..b041c83d60 100644 --- a/src/Gui/QSint/actionpanel/actionpanelscheme.cpp +++ b/src/Gui/QSint/actionpanel/actionpanelscheme.cpp @@ -65,22 +65,45 @@ QString ActionPanelScheme::systemStyle(const QPalette& p) return style; } -// Draws fold/unfold icons based on the palette -QPixmap ActionPanelScheme::drawFoldIcon(const QPalette& palette, bool fold, bool /*hover*/) const +QPixmap ActionPanelScheme::drawFoldIcon(const QPalette& palette, bool fold, bool hover) const { - QStyle::StandardPixmap iconType = fold ? QStyle::SP_ArrowUp : QStyle::SP_ArrowDown; - QIcon icon = qApp->style()->standardIcon(iconType); - - QSize iconSize = headerButtonSize; - QPixmap pixmap = icon.pixmap(iconSize); - QImage img = pixmap.toImage(); - img = img.convertToFormat(QImage::Format_ARGB32); + QSize bSize = headerButtonSize; + QImage img(bSize.width(), bSize.height(), QImage::Format_ARGB32_Premultiplied); + img.fill(Qt::transparent); QPainter painter(&img); - painter.setCompositionMode(QPainter::CompositionMode_SourceIn); - painter.fillRect(img.rect(), palette.color(QPalette::HighlightedText)); - painter.end(); + painter.setRenderHint(QPainter::Antialiasing); + + qreal penWidth = bSize.width() / 14.0; + qreal lef_X = 0.25 * bSize.width(); + qreal mid_X = 0.50 * bSize.width(); + qreal rig_X = 0.75 * bSize.width(); + qreal bot_Y = 0.40 * bSize.height(); + qreal top_Y = 0.64 * bSize.height(); + + if (hover) { + penWidth *= 1.8; + } + + painter.setBrush(Qt::NoBrush); + painter.setPen(QPen(palette.color(QPalette::HighlightedText), penWidth)); + + QPolygon chevron; + if (fold) { + // Upward + chevron << QPoint(lef_X, top_Y) + << QPoint(mid_X, bot_Y) + << QPoint(rig_X, top_Y); + } else { + // Downward + chevron << QPoint(lef_X, bot_Y) + << QPoint(mid_X, top_Y) + << QPoint(rig_X, bot_Y); + } + + painter.drawPolyline(chevron); + painter.end(); return QPixmap::fromImage(img); }