From e044946f2327762dc359aba82ec293efcc2e7ae2 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Mon, 22 Oct 2007 13:56:59 +0000 Subject: [PATCH] * GuiPrefs.cpp (PrefShortcuts::setItemType): compilation fix for qt 4.1 and some simplification. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21118 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiPrefs.cpp | 35 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/src/frontends/qt4/GuiPrefs.cpp b/src/frontends/qt4/GuiPrefs.cpp index 3dcefaf175..d859096983 100644 --- a/src/frontends/qt4/GuiPrefs.cpp +++ b/src/frontends/qt4/GuiPrefs.cpp @@ -1821,41 +1821,30 @@ void PrefShortcuts::updateShortcutsTW() void PrefShortcuts::setItemType(QTreeWidgetItem * item, item_type tag) { item->setData(0, Qt::UserRole, QVariant(tag)); + QString color; switch (tag) { case System: -#if QT_VERSION >= 0x040200 - item->setForeground(0, QBrush("black")); - item->setForeground(1, QBrush("black")); -#else - item->setTextColor(QColor("black")); -#endif + color = "black"; break; case UserBind: -#if QT_VERSION >= 0x040200 - item->setForeground(0, QBrush("green")); - item->setForeground(1, QBrush("green")); -#else - item->setTextColor(QColor("green")); -#endif + color = "green"; break; case UserUnbind: -#if QT_VERSION >= 0x040200 - item->setForeground(0, QBrush("red")); - item->setForeground(1, QBrush("red")); -#else - item->setTextColor(QColor("red")); -#endif + color = "red"; break; case UserExtraUnbind: + color = "purple"; + break; + } + #if QT_VERSION >= 0x040200 - item->setForeground(0, QBrush("purple")); - item->setForeground(1, QBrush("purple")); + item->setForeground(0, QBrush(color)); + item->setForeground(1, QBrush(color)); #else - item->setTextColor(QColor("purple")); + item->setTextColor(0, QColor(color)); + item->setTextColor(1, QColor(color)); #endif - break; - } } -- 2.39.2