r24358 by jghali - Improve behavior of arrow combobox in dark mode

scribus-commit scribus-commit at lists.scribus.net
Mon Dec 28 20:37:51 UTC 2020


Author: jghali
Date: Mon Dec 28 20:37:51 2020
New Revision: 24358

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24358
Log:
Improve behavior of arrow combobox in dark mode

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

Modified: trunk/Scribus/scribus/ui/arrowchooser.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24358&path=/trunk/Scribus/scribus/ui/arrowchooser.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/arrowchooser.cpp	(original)
+++ trunk/Scribus/scribus/ui/arrowchooser.cpp	Mon Dec 28 20:37:51 2020
@@ -5,13 +5,16 @@
 for which a new license (GPL+exception) is in place.
 */
 #include "arrowchooser.h"
+
+#include <QImage>
+#include <QPalette>
 #include <QPixmap>
-#include <QImage>
+
+#include "commonstrings.h"
 #include "fpointarray.h"
 #include "scpainter.h"
+#include "scribusstructs.h"
 #include "util_math.h"
-#include "commonstrings.h"
-#include "scribusstructs.h"
 
 ArrowChooser::ArrowChooser(QWidget* pa, bool direction) : QComboBox(pa)
 {
@@ -29,22 +32,26 @@
 
 void ArrowChooser::rebuildList(QList<ArrowDesc> *arrowStyles)
 {
+	FPointArray path;
+
 	clear();
-	FPointArray path;
-	path.resize(0);
+
+	const QPalette& pal = this->palette();
+	QColor textColor = pal.color(QPalette::Active, QPalette::Text);
+
 	addItem(CommonStrings::tr_None);
-	for (int a = 0; a < arrowStyles->count(); ++a)
+	for (int i = 0; i < arrowStyles->count(); ++i)
 	{
 		QImage image(22, 22, QImage::Format_ARGB32_Premultiplied);
 		image.fill(0);
 		ScPainter *painter = new ScPainter(&image, 22, 22);
 //		painter->clear();
-		painter->setBrush(qRgb(0, 0, 0));
-		painter->setPen(qRgb(0, 0, 0), 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
+		painter->setBrush(textColor);
+		painter->setPen(textColor, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
 		painter->setFillMode(1);
 		painter->translate(3.0, 3.0);
 		path.resize(0);
-		path = arrowStyles->at(a).points.copy();
+		path = arrowStyles->at(i).points.copy();
 		FPoint min = getMinClipF(&path);
 		path.translate(-min.x(), -min.y());
 		FPoint max = path.widthHeight();
@@ -74,8 +81,7 @@
 				s++;
 			}
 		} */
-		QPixmap Ico;
-		Ico=QPixmap::fromImage(image);
-		addItem(Ico, arrowStyles->at(a).name);
+		QPixmap ico = QPixmap::fromImage(image);
+		addItem(ico, arrowStyles->at(i).name);
 	}
 }




More information about the scribus-commit mailing list