r24657 by jghali - #16585: Sidebars arrows don't follow system dark theme

scribus-commit scribus-commit at lists.scribus.net
Fri Jun 4 21:30:19 UTC 2021


Author: jghali
Date: Fri Jun  4 21:30:18 2021
New Revision: 24657

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24657
Log:
#16585: Sidebars arrows don't follow system dark theme

Modified:
    trunk/Scribus/scribus/ui/sctreewidget.cpp

Modified: trunk/Scribus/scribus/ui/sctreewidget.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24657&path=/trunk/Scribus/scribus/ui/sctreewidget.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/sctreewidget.cpp	(original)
+++ trunk/Scribus/scribus/ui/sctreewidget.cpp	Fri Jun  4 21:30:18 2021
@@ -50,13 +50,14 @@
 		buttonOption.rect = option.rect;
 		buttonOption.palette = option.palette;
 		m_view->style()->drawControl(QStyle::CE_PushButton, &buttonOption, painter, m_view);
+
+		// Draw arrow
 		static const int i = 9; // ### hardcoded in qcommonstyle.cpp
 		QRect r = option.rect;
+		QPalette::ColorGroup arrowColorGroup = (option.state & QStyle::State_Enabled) ? QPalette::Active : QPalette::Disabled;
+		QColor arrowColor = option.palette.color(arrowColorGroup, QPalette::ButtonText);
 		painter->save();
-		if (option.state & QStyle::State_Enabled)
-			painter->setBrush(Qt::black);
-		else
-			painter->setBrush(Qt::gray);
+		painter->setBrush(arrowColor);
 		painter->setPen(Qt::NoPen);
 		QRect rect = QRect(r.left() + 6, r.top() + 6, r.height() - 12, r.height() - 12);
 		QPolygon pa(3);
@@ -75,7 +76,8 @@
 		painter->setRenderHint(QPainter::Antialiasing, true);
 		painter->drawPolygon(pa);
 		painter->restore();
-			// draw text
+
+		// Draw text
 		QRect textrect = QRect(r.left() + i * 2, r.top(), r.width() - ((5 * i) / 2), r.height());
 		QString text = option.fontMetrics.elidedText(model->data(index, Qt::DisplayRole).toString(), Qt::ElideMiddle, textrect.width(), Qt::TextShowMnemonic);
 		m_view->style()->drawItemText(painter, textrect, Qt::AlignCenter | Qt::TextShowMnemonic, option.palette, (option.state & QStyle::State_Enabled), text, QPalette::Text);




More information about the scribus-commit mailing list