From c0f0f2fb3817496d498c8fee4f6cdb81eaa52c8c Mon Sep 17 00:00:00 2001 From: Peinthor Rene Date: Sat, 30 Mar 2013 18:17:11 +0100 Subject: [PATCH] small addition show the chosen color in the column --- src/PreferencesDialog.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/PreferencesDialog.cpp b/src/PreferencesDialog.cpp index 36c3eae4..f04b3674 100644 --- a/src/PreferencesDialog.cpp +++ b/src/PreferencesDialog.cpp @@ -47,7 +47,11 @@ void PreferencesDialog::loadSettings() for(int i=0;itreeSyntaxHighlighting->topLevelItemCount();i++) { QString name = ui->treeSyntaxHighlighting->topLevelItem(i)->text(0); - ui->treeSyntaxHighlighting->topLevelItem(i)->setText(2, getSettingsValue("syntaxhighlighter", name + "_colour").toString()); + QString colorname = getSettingsValue("syntaxhighlighter", name + "_colour").toString(); + QColor color = QColor(colorname); + ui->treeSyntaxHighlighting->topLevelItem(i)->setTextColor(2, color); + ui->treeSyntaxHighlighting->topLevelItem(i)->setBackgroundColor(2, color); + ui->treeSyntaxHighlighting->topLevelItem(i)->setText(2, colorname); ui->treeSyntaxHighlighting->topLevelItem(i)->setCheckState(3, getSettingsValue("syntaxhighlighter", name + "_bold").toBool() ? Qt::Checked : Qt::Unchecked); ui->treeSyntaxHighlighting->topLevelItem(i)->setCheckState(4, getSettingsValue("syntaxhighlighter", name + "_italic").toBool() ? Qt::Checked : Qt::Unchecked); ui->treeSyntaxHighlighting->topLevelItem(i)->setCheckState(5, getSettingsValue("syntaxhighlighter", name + "_underline").toBool() ? Qt::Checked : Qt::Unchecked); @@ -174,5 +178,9 @@ void PreferencesDialog::showColourDialog(QTreeWidgetItem* item, int column) QColor colour = QColorDialog::getColor(QColor(item->text(column)), this); if(colour.isValid()) + { + item->setTextColor(column, colour); + item->setBackgroundColor(column, colour); item->setText(column, colour.name()); + } }