From cf92b03995dfbe28935e5148d43da7d91943f93a Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Thu, 19 Apr 2018 18:25:48 -0300 Subject: [PATCH] Active container (light gray) and edit (yellow) colors in Tree view are now changeable in prefs->display->colors --- src/Gui/DlgSettingsViewColor.cpp | 4 + src/Gui/DlgSettingsViewColor.ui | 531 +++++++++++++++++-------------- src/Gui/Tree.cpp | 11 +- 3 files changed, 300 insertions(+), 246 deletions(-) diff --git a/src/Gui/DlgSettingsViewColor.cpp b/src/Gui/DlgSettingsViewColor.cpp index 4283162e57..37fddaa2dd 100644 --- a/src/Gui/DlgSettingsViewColor.cpp +++ b/src/Gui/DlgSettingsViewColor.cpp @@ -67,6 +67,8 @@ void DlgSettingsViewColor::saveSettings() HighlightColor->onSave(); SelectionColor->onSave(); spinPickRadius->onSave(); + TreeEditColor->onSave(); + TreeActiveColor->onSave(); } void DlgSettingsViewColor::loadSettings() @@ -83,6 +85,8 @@ void DlgSettingsViewColor::loadSettings() HighlightColor->onRestore(); SelectionColor->onRestore(); spinPickRadius->onRestore(); + TreeEditColor->onRestore(); + TreeActiveColor->onRestore(); } /** diff --git a/src/Gui/DlgSettingsViewColor.ui b/src/Gui/DlgSettingsViewColor.ui index c1c9b46f73..543008a392 100644 --- a/src/Gui/DlgSettingsViewColor.ui +++ b/src/Gui/DlgSettingsViewColor.ui @@ -6,45 +6,234 @@ 0 0 - 601 - 598 + 505 + 609 Colors - - 9 - - - 9 - - - 9 - - + 9 6 + + + + Background color + + + + 9 + + + 6 + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 0 + + + 6 + + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 171 + 20 + + + + + + + + false + + + + 0 + 0 + + + + + + + + 20 + 20 + 163 + + + + BackgroundColor + + + View + + + + + + + Middle color + + + UseBackgroundColorMid + + + View + + + + + + + + + + + 151 + 151 + 170 + + + + BackgroundColor3 + + + View + + + + + + + false + + + + + + + 111 + 111 + 147 + + + + BackgroundColor4 + + + View + + + + + + + Color gradient + + + true + + + Gradient + + + View + + + + + + + + + + + 51 + 51 + 101 + + + + BackgroundColor2 + + + View + + + + + + + + 240 + 0 + + + + Simple color + + + Simple + + + View + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + Selection - - 9 - - - 9 - - - 9 - - + 9 @@ -65,16 +254,7 @@ - - 0 - - - 0 - - - 0 - - + 0 @@ -88,7 +268,7 @@ - + 28 173 @@ -139,7 +319,7 @@ - + 225 225 @@ -210,29 +390,82 @@ - - + + - Background color + Tree View - - - 9 - - - 9 - - - 9 - - - 9 - - - 6 - - - + + + + + + + + 230 + 230 + 255 + + + + TreeActiveColor + + + TreeView + + + + + + + Active container + + + + + + + Object being edited + + + + + + + + 255 + 255 + 0 + + + + TreeEditColor + + + TreeView + + + + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 240 + 20 + + + + + + + + Qt::Horizontal @@ -244,197 +477,9 @@ - - - - 0 - - - 0 - - - 0 - - - 0 - - - 6 - - - - - Qt::Horizontal - - - QSizePolicy::Minimum - - - - 171 - 20 - - - - - - - - false - - - - 0 - 0 - - - - - - - - 20 - 20 - 163 - - - - BackgroundColor - - - View - - - - - - - Middle color - - - UseBackgroundColorMid - - - View - - - - - - - - - - - 151 - 151 - 170 - - - - BackgroundColor3 - - - View - - - - - - - false - - - - - - - 111 - 111 - 147 - - - - BackgroundColor4 - - - View - - - - - - - Color gradient - - - true - - - Gradient - - - View - - - - - - - - - - - 51 - 51 - 101 - - - - BackgroundColor2 - - - View - - - - - - - - 240 - 0 - - - - Simple color - - - Simple - - - View - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - diff --git a/src/Gui/Tree.cpp b/src/Gui/Tree.cpp index 3f36bbf96e..3f903926b9 100644 --- a/src/Gui/Tree.cpp +++ b/src/Gui/Tree.cpp @@ -977,8 +977,10 @@ DocumentItem::~DocumentItem() void DocumentItem::slotInEdit(const Gui::ViewProviderDocumentObject& v) { + ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/TreeView"); + unsigned long col = hGrp->GetUnsigned("TreeEditColor",4294902015); FOREACH_ITEM(item,v) - item->setBackgroundColor(0,Qt::yellow); + item->setBackgroundColor(0,QColor((col >> 24) & 0xff,(col >> 16) & 0xff,(col >> 8) & 0xff)); END_FOREACH_ITEM } @@ -1279,8 +1281,11 @@ void DocumentItem::slotHighlightObject (const Gui::ViewProviderDocumentObject& o item->setData(0, Qt::BackgroundColorRole,QVariant()); break; case Gui::LightBlue: - if (set) - item->setBackgroundColor(0,QColor(230,230,255)); + if (set) { + ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/TreeView"); + unsigned long col = hGrp->GetUnsigned("TreeActiveColor",3873898495); + item->setBackgroundColor(0,QColor((col >> 24) & 0xff,(col >> 16) & 0xff,(col >> 8) & 0xff)); + } else item->setData(0, Qt::BackgroundColorRole,QVariant()); break;