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

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


The following commit has been merged in the master branch:
commit f18fef67ad7ebd2176c3a8acd01d41507964460c
Author: Eugeniy Meshcheryakov <eugen at debian.org>
Date:   Tue Sep 9 15:47:28 2008 +0200

    make it possible to choose a color, sometimes

diff --git a/gui/glyphpropertieseditor.cxx b/gui/glyphpropertieseditor.cxx
index d0784b1..279b6c2 100644
--- a/gui/glyphpropertieseditor.cxx
+++ b/gui/glyphpropertieseditor.cxx
@@ -26,6 +26,9 @@
 #include <QGroupBox>
 #include <QTextEdit>
 #include <QVBoxLayout>
+#include <QHBoxLayout>
+#include <QToolButton>
+#include <QColorDialog>
 #include "unicodevalueeditor.h"
 
 /** \class GlyphPropertiesEditor glyphpropertieseditor.h
@@ -54,7 +57,13 @@ GlyphPropertiesEditor::GlyphPropertiesEditor(QAbstractItemModel *model, const QM
 	QLineEdit *nameEdit = new QLineEdit;
 
 	QLabel *colorLabel = new QLabel("Color:");
-	ColorComboBox *colorComboBox = new ColorComboBox;
+	m_colorComboBox = new ColorComboBox;
+	QToolButton *colorBtn = new QToolButton;
+	colorBtn->setText("...");
+	QHBoxLayout *hbox = new QHBoxLayout;
+	hbox->addWidget(m_colorComboBox);
+	hbox->addWidget(colorBtn);
+	connect(colorBtn, SIGNAL(clicked()), this, SLOT(chooseColor()));
 
 	QLabel *unicodeLabel = new QLabel("Unicode value:");
 	UnicodeValueEditor *unicodeEdit = new UnicodeValueEditor;
@@ -81,7 +90,7 @@ GlyphPropertiesEditor::GlyphPropertiesEditor(QAbstractItemModel *model, const QM
 	grid->addWidget(unicodeLabel, 1, 0);
 	grid->addWidget(unicodeEdit, 1, 1);
 	grid->addWidget(colorLabel, 2, 0);
-	grid->addWidget(colorComboBox, 2, 1);
+	grid->addLayout(hbox, 2, 1);
 	grid->addWidget(commentBox, 3, 0, 1, 2);
 	grid->addWidget(buttonBox, 0, 2, 4, 1);
 	setLayout(grid);
@@ -94,7 +103,7 @@ GlyphPropertiesEditor::GlyphPropertiesEditor(QAbstractItemModel *model, const QM
 	mapper = new QDataWidgetMapper(this);
 	mapper->setModel(model);
 	mapper->addMapping(nameEdit, GlyphsModel::NameColumn);
-	mapper->addMapping(colorComboBox, GlyphsModel::ColorColumn);
+	mapper->addMapping(m_colorComboBox, GlyphsModel::ColorColumn);
 	mapper->addMapping(unicodeEdit, GlyphsModel::UnicodeColumn);
 	mapper->addMapping(commentText, GlyphsModel::CommentColumn, "plainText");
 	mapper->setCurrentIndex(item.row());
@@ -130,3 +139,11 @@ void GlyphPropertiesEditor::buttonClicked(QAbstractButton *button)
 	if (buttonBox->buttonRole(button) == QDialogButtonBox::ApplyRole)
 		mapper->submit();
 }
+
+void GlyphPropertiesEditor::chooseColor()
+{
+	QColor oldColor = m_colorComboBox->color();
+	QColor newColor = QColorDialog::getColor(oldColor, this);
+	if (newColor.isValid())
+		m_colorComboBox->setColor(newColor);
+}
diff --git a/gui/glyphpropertieseditor.h b/gui/glyphpropertieseditor.h
index 21cbcf2..ab09c9b 100644
--- a/gui/glyphpropertieseditor.h
+++ b/gui/glyphpropertieseditor.h
@@ -22,6 +22,7 @@ class QDataWidgetMapper;
 class QModelIndex;
 class QAbstractButton;
 class QDialogButtonBox;
+class ColorComboBox;
 
 class GlyphPropertiesEditor : public QDialog
 {
@@ -33,9 +34,11 @@ private slots:
 	void next();
 	void previous();
 	void buttonClicked(QAbstractButton *button);
+	void chooseColor();
 private:
 	QDataWidgetMapper *mapper;
 	QDialogButtonBox *buttonBox;
+	ColorComboBox *m_colorComboBox;
 };
 
 #endif

-- 
Fondue Font Editor



More information about the fondue-commits mailing list