diff --git a/src/Gui/DlgSettingsNavigation.cpp b/src/Gui/DlgSettingsNavigation.cpp index 635624d9ab..3785b57edb 100644 --- a/src/Gui/DlgSettingsNavigation.cpp +++ b/src/Gui/DlgSettingsNavigation.cpp @@ -57,6 +57,7 @@ DlgSettingsNavigation::DlgSettingsNavigation(QWidget* parent) , q0(0), q1(0), q2(0), q3(1) { ui->setupUi(this); + ui->naviCubeButtonColor->setAllowTransparency(true); retranslate(); } @@ -93,6 +94,7 @@ void DlgSettingsNavigation::saveSettings() ui->naviCubeToNearest->onSave(); ui->prefCubeSize->onSave(); ui->naviCubeFontSize->onSave(); + ui->naviCubeButtonColor->onSave(); bool showNaviCube = ui->groupBoxNaviCube->isChecked(); hGrp->SetBool("ShowNaviCube", showNaviCube); @@ -141,6 +143,7 @@ void DlgSettingsNavigation::loadSettings() ui->naviCubeToNearest->onRestore(); ui->prefCubeSize->onRestore(); ui->naviCubeFontSize->onRestore(); + ui->naviCubeButtonColor->onRestore(); ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath ("User parameter:BaseApp/Preferences/View"); diff --git a/src/Gui/DlgSettingsNavigation.ui b/src/Gui/DlgSettingsNavigation.ui index d23179c966..cdfba602f2 100644 --- a/src/Gui/DlgSettingsNavigation.ui +++ b/src/Gui/DlgSettingsNavigation.ui @@ -6,8 +6,8 @@ 0 0 - 500 - 394 + 432 + 423 @@ -117,7 +117,7 @@ - + Rotates to nearest possible state when clicking a cube face @@ -136,14 +136,14 @@ - - + + Font name: - + Font name of the navigation cube @@ -159,14 +159,14 @@ - - + + Cube size - + Size of the navigation cube @@ -194,14 +194,14 @@ - - + + Font size: - + @@ -232,6 +232,34 @@ + + + + Button color + + + + + + + color for all elements +around the cube + + + + 226 + 232 + 239 + + + + ButtonColor + + + NaviCube + + + @@ -640,11 +668,21 @@ Mouse tilting is not disabled by this setting. + + Gui::ColorButton + QPushButton +
Gui/Widgets.h
+
Gui::PrefSpinBox QSpinBox
Gui/PrefWidgets.h
+ + Gui::PrefColorButton + Gui::ColorButton +
Gui/PrefWidgets.h
+
Gui::PrefCheckBox QCheckBox diff --git a/src/Gui/NaviCube.cpp b/src/Gui/NaviCube.cpp index 7977f3bf00..0d2a2cbc09 100644 --- a/src/Gui/NaviCube.cpp +++ b/src/Gui/NaviCube.cpp @@ -292,6 +292,11 @@ void NaviCube::setFontSize(int size) m_NaviCubeImplementation->m_CubeTextSize = size; } +void NaviCube::setButtonColor(QColor ButtonColor) +{ + m_NaviCubeImplementation->m_ButtonColor = ButtonColor; +} + QString NaviCube::getDefaultSansserifFont() { // Windows versions since 2017 have the 'Bahnschrift' font (a condensed @@ -379,7 +384,12 @@ void NaviCubeImplementation::OnChange(ParameterGrp::SubjectType& rCaller, m_HiliteColor.setRgba(rGrp.GetUnsigned(reason, QColor(170, 226, 255, 255).rgba())); } else if (strcmp(reason, "ButtonColor") == 0) { - m_ButtonColor.setRgba(rGrp.GetUnsigned(reason, QColor(226, 233, 239, 128).rgba())); + // the color is stored in the form ARRGGBB thus we cannot read in using .rgba() + unsigned long col = rGrp.GetUnsigned("ButtonColor", 3806916480); + // 3806916480 is AAA,RRR,GGG,BBB: 128,226,233,239 + QColor buttonColor( + (col >> 24) & 0xff, (col >> 16) & 0xff, (col >> 8) & 0xff, col & 0xff); + m_ButtonColor = buttonColor; } else if (strcmp(reason, "CornerNaviCube") == 0) { m_Corner = static_cast(rGrp.GetInt(reason, 1)); diff --git a/src/Gui/NaviCube.h b/src/Gui/NaviCube.h index 6ed30c0c62..af92eb125e 100644 --- a/src/Gui/NaviCube.h +++ b/src/Gui/NaviCube.h @@ -52,6 +52,7 @@ public: void setNaviStepByTurn(int steps); void setFont(std::string font); void setFontSize(int size); + void setButtonColor(QColor buttonColor); static QString getDefaultSansserifFont(); int getDefaultFontSize(); static void setNaviCubeCommands(const std::vector& cmd); diff --git a/src/Gui/SoTextLabel.cpp b/src/Gui/SoTextLabel.cpp index 62e2f0d8ee..5448e3ba2c 100644 --- a/src/Gui/SoTextLabel.cpp +++ b/src/Gui/SoTextLabel.cpp @@ -341,7 +341,7 @@ void SoStringLabel::GLRender(SoGLRenderAction *action) // text color SbColor color = this->textColor.getValue(); - glColor4f(color[0], color[1], color[2],1); + glColor4f(color[0], color[1], color[2], 1); const SbMatrix & mat = SoModelMatrixElement::get(state); const SbMatrix & projmatrix = (mat * SoViewingMatrixElement::get(state) * SoProjectionMatrixElement::get(state)); diff --git a/src/Gui/View3DInventor.cpp b/src/Gui/View3DInventor.cpp index 1b987df3e5..ca90d54cf4 100644 --- a/src/Gui/View3DInventor.cpp +++ b/src/Gui/View3DInventor.cpp @@ -402,6 +402,9 @@ void View3DInventor::OnChange(ParameterGrp::SubjectType &rCaller,ParameterGrp::M "FontString", NaviCube::getDefaultSansserifFont().toStdString().c_str()); _viewer->getNavigationCube()->setFont(font); } + else if (strcmp(Reason, "ButtonColor") == 0) { + _viewer->getNavigationCube()->setButtonColor(rGrp.GetUnsigned("ButtonColor", 3806916480)); + } else if (strcmp(Reason,"UseVBO") == 0) { _viewer->setEnabledVBO(rGrp.GetBool("UseVBO", false)); }