r23450 by jghali - Add setCurrentColor() to ColorCombo class

scribus-commit scribus-commit at lists.scribus.net
Sat Jan 25 18:05:41 UTC 2020


Author: jghali
Date: Sat Jan 25 18:05:40 2020
New Revision: 23450

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23450
Log:
Add setCurrentColor() to ColorCombo class

Modified:
    trunk/Scribus/scribus/ui/colorcombo.cpp
    trunk/Scribus/scribus/ui/colorcombo.h

Modified: trunk/Scribus/scribus/ui/colorcombo.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23450&path=/trunk/Scribus/scribus/ui/colorcombo.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/colorcombo.cpp	(original)
+++ trunk/Scribus/scribus/ui/colorcombo.cpp	Sat Jan 25 18:05:40 2020
@@ -69,6 +69,16 @@
 	clm->setColorList(list, insertNone);
 }
 
+void ColorCombo::setCurrentColor(QString colorName)
+{
+	if (colorName == CommonStrings::None)
+		colorName = CommonStrings::tr_NoneColor;
+	
+	int index = findText(colorName);
+	if (index >= 0)
+		this->setCurrentIndex(index);
+}
+
 void ColorCombo::setPixmapType(ColorCombo::PixmapType type)
 {
 	ColorListBox* clb = dynamic_cast<ColorListBox*>(view());

Modified: trunk/Scribus/scribus/ui/colorcombo.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23450&path=/trunk/Scribus/scribus/ui/colorcombo.h
==============================================================================
--- trunk/Scribus/scribus/ui/colorcombo.h	(original)
+++ trunk/Scribus/scribus/ui/colorcombo.h	Sat Jan 25 18:05:40 2020
@@ -50,6 +50,7 @@
 	QString currentColor() const;
 
 	void setColors(ColorList& list, bool insertNone = true);
+	void setCurrentColor(QString colorName);
 	void setPixmapType(ColorCombo::PixmapType type);
 
 	void initColorList(ColorList* colorList, ScribusDoc* doc, const QString& colorValue);




More information about the scribus-commit mailing list