Active container (light gray) and edit (yellow) colors in Tree view are now changeable in prefs->display->colors

This commit is contained in:
Yorik van Havre
2018-04-19 18:25:48 -03:00
parent 20296b5636
commit cf92b03995
3 changed files with 300 additions and 246 deletions

View File

@@ -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();
}
/**

View File

@@ -6,45 +6,234 @@
<rect>
<x>0</x>
<y>0</y>
<width>601</width>
<height>598</height>
<width>505</width>
<height>609</height>
</rect>
</property>
<property name="windowTitle">
<string>Colors</string>
</property>
<layout class="QGridLayout">
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<property name="margin">
<number>9</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="1" column="0">
<widget class="QGroupBox" name="groupBoxColor">
<property name="title">
<string>Background color</string>
</property>
<layout class="QGridLayout">
<property name="margin">
<number>9</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="1">
<spacer name="spacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<layout class="QGridLayout" name="_4">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="2" column="0">
<spacer name="spacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>171</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="Gui::PrefColorButton" name="SelectionColor_Background">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
<property name="color">
<color>
<red>20</red>
<green>20</green>
<blue>163</blue>
</color>
</property>
<property name="prefEntry" stdset="0">
<cstring>BackgroundColor</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="Gui::PrefCheckBox" name="checkMidColor">
<property name="text">
<string>Middle color</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>UseBackgroundColorMid</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="Gui::PrefColorButton" name="backgroundColorTo">
<property name="text">
<string/>
</property>
<property name="color">
<color>
<red>151</red>
<green>151</green>
<blue>170</blue>
</color>
</property>
<property name="prefEntry" stdset="0">
<cstring>BackgroundColor3</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="Gui::PrefColorButton" name="backgroundColorMid">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string/>
</property>
<property name="color">
<color>
<red>111</red>
<green>111</green>
<blue>147</blue>
</color>
</property>
<property name="prefEntry" stdset="0">
<cstring>BackgroundColor4</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="Gui::PrefRadioButton" name="radioButtonGradient">
<property name="text">
<string>Color gradient</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>Gradient</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="Gui::PrefColorButton" name="backgroundColorFrom">
<property name="text">
<string/>
</property>
<property name="color">
<color>
<red>51</red>
<green>51</green>
<blue>101</blue>
</color>
</property>
<property name="prefEntry" stdset="0">
<cstring>BackgroundColor2</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="Gui::PrefRadioButton" name="radioButtonSimple">
<property name="minimumSize">
<size>
<width>240</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Simple color</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>Simple</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="3" column="0">
<spacer name="spacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<widget class="QGroupBox" name="groupBoxSelection">
<property name="title">
<string>Selection</string>
</property>
<layout class="QGridLayout">
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<property name="margin">
<number>9</number>
</property>
<property name="spacing">
@@ -65,16 +254,7 @@
</item>
<item row="0" column="0">
<layout class="QGridLayout" name="_3">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
@@ -88,7 +268,7 @@
<property name="text">
<string/>
</property>
<property name="color" stdset="0">
<property name="color">
<color>
<red>28</red>
<green>173</green>
@@ -139,7 +319,7 @@
<property name="text">
<string/>
</property>
<property name="color" stdset="0">
<property name="color">
<color>
<red>225</red>
<green>225</green>
@@ -210,29 +390,82 @@
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="groupBoxColor">
<item row="2" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Background color</string>
<string>Tree View</string>
</property>
<layout class="QGridLayout">
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="1">
<spacer name="spacer">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="1">
<widget class="Gui::PrefColorButton" name="TreeActiveColor">
<property name="color">
<color>
<red>230</red>
<green>230</green>
<blue>255</blue>
</color>
</property>
<property name="prefEntry" stdset="0">
<cstring>TreeActiveColor</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>TreeView</cstring>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Active container</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Object being edited</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="Gui::PrefColorButton" name="TreeEditColor">
<property name="color">
<color>
<red>255</red>
<green>255</green>
<blue>0</blue>
</color>
</property>
<property name="prefEntry" stdset="0">
<cstring>TreeEditColor</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>TreeView</cstring>
</property>
</widget>
</item>
<item row="2" column="0">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>240</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@@ -244,197 +477,9 @@
</property>
</spacer>
</item>
<item row="0" column="0">
<layout class="QGridLayout" name="_4">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="2" column="0">
<spacer name="spacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>171</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="Gui::PrefColorButton" name="SelectionColor_Background">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
<property name="color" stdset="0">
<color>
<red>20</red>
<green>20</green>
<blue>163</blue>
</color>
</property>
<property name="prefEntry" stdset="0">
<cstring>BackgroundColor</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="Gui::PrefCheckBox" name="checkMidColor">
<property name="text">
<string>Middle color</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>UseBackgroundColorMid</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="Gui::PrefColorButton" name="backgroundColorTo">
<property name="text">
<string/>
</property>
<property name="color" stdset="0">
<color>
<red>151</red>
<green>151</green>
<blue>170</blue>
</color>
</property>
<property name="prefEntry" stdset="0">
<cstring>BackgroundColor3</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="Gui::PrefColorButton" name="backgroundColorMid">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string/>
</property>
<property name="color" stdset="0">
<color>
<red>111</red>
<green>111</green>
<blue>147</blue>
</color>
</property>
<property name="prefEntry" stdset="0">
<cstring>BackgroundColor4</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="Gui::PrefRadioButton" name="radioButtonGradient">
<property name="text">
<string>Color gradient</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>Gradient</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="Gui::PrefColorButton" name="backgroundColorFrom">
<property name="text">
<string/>
</property>
<property name="color" stdset="0">
<color>
<red>51</red>
<green>51</green>
<blue>101</blue>
</color>
</property>
<property name="prefEntry" stdset="0">
<cstring>BackgroundColor2</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="Gui::PrefRadioButton" name="radioButtonSimple">
<property name="minimumSize">
<size>
<width>240</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Simple color</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>Simple</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<spacer name="spacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>

View File

@@ -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;