[fondue-commits] [SCM] Fondue Font Editor branch, master, updated. 8421a8499180144f1980fbff2a44fee85e0887ba

Eugeniy Meshcheryakov eugen at debian.org
Tue Sep 30 13:59:36 UTC 2008


The following commit has been merged in the master branch:
commit 8621d0189e6f7a17b947f53705e1423fe39d6595
Author: Eugeniy Meshcheryakov <eugen at debian.org>
Date:   Sun Sep 14 18:56:49 2008 +0200

    make color chooser more usable

diff --git a/gui/colorcombobox.cxx b/gui/colorcombobox.cxx
index f37c8b2..8821d83 100644
--- a/gui/colorcombobox.cxx
+++ b/gui/colorcombobox.cxx
@@ -19,7 +19,7 @@
 
 ColorComboBox::ColorComboBox(QWidget *parent) : QComboBox(parent)
 {
-//	setEditable(true); // TODO
+	setEditable(true);
 
 	QStringList colors = QColor::colorNames();
 
@@ -35,11 +35,20 @@ ColorComboBox::ColorComboBox(QWidget *parent) : QComboBox(parent)
 
 QColor ColorComboBox::color() const
 {
-	return qVariantValue<QColor>(itemData(currentIndex(), Qt::DecorationRole));
+	// TODO check currentText() value, or add validator
+	return QColor(currentText());
 }
 
 void ColorComboBox::setColor(QColor color)
 {
-	// TODO it should be possible to use custom colors
-	setCurrentIndex(qMax(findData(color, int(Qt::DecorationRole)), 0));
+	if (!color.isValid()) {
+		setCurrentIndex(0);
+		return;
+	}
+
+	int newIdx = findData(color, int(Qt::DecorationRole));
+	if (newIdx != -1)
+		setCurrentIndex(newIdx);
+	else
+		setEditText(color.name());
 }

-- 
Fondue Font Editor



More information about the fondue-commits mailing list