From 9976b4cf84b8983f2c5f0bc590e56ee53c2896ed Mon Sep 17 00:00:00 2001 From: mwganson Date: Fri, 24 Dec 2021 13:41:54 -0600 Subject: [PATCH] [core] Add new parameter to BaseApp/Preferences/Dialog called DontUseNativeColorDialog, default to true --- src/Gui/TaskElementColors.cpp | 10 ++++++++++ src/Gui/Widgets.cpp | 12 ++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/Gui/TaskElementColors.cpp b/src/Gui/TaskElementColors.cpp index d92dbf9a73..5795310f69 100644 --- a/src/Gui/TaskElementColors.cpp +++ b/src/Gui/TaskElementColors.cpp @@ -237,6 +237,11 @@ public: auto color = item->data(Qt::UserRole).value(); QColorDialog cd(color, parent); cd.setOption(QColorDialog::ShowAlphaChannel); + ParameterGrp::handle group = App::GetApplication().GetUserParameter(). + GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Dialog"); + bool notNativeColorDialog = group->GetBool("DontUseNativeColorDialog", true); + if (notNativeColorDialog) + cd.setOptions(QColorDialog::DontUseNativeDialog); if (cd.exec()!=QDialog::Accepted || color==cd.selectedColor()) return; color = cd.selectedColor(); @@ -426,6 +431,11 @@ void ElementColors::on_addSelection_clicked() auto color = d->items.front()->data(Qt::UserRole).value(); QColorDialog cd(color, this); cd.setOption(QColorDialog::ShowAlphaChannel); + ParameterGrp::handle group = App::GetApplication().GetUserParameter(). + GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Dialog"); + bool notNativeColorDialog = group->GetBool("DontUseNativeColorDialog", true); + if (notNativeColorDialog) + cd.setOptions(QColorDialog::DontUseNativeDialog); if (cd.exec()!=QDialog::Accepted) return; color = cd.selectedColor(); diff --git a/src/Gui/Widgets.cpp b/src/Gui/Widgets.cpp index e3c1c87147..5bfbfd1b4c 100644 --- a/src/Gui/Widgets.cpp +++ b/src/Gui/Widgets.cpp @@ -782,7 +782,11 @@ void ColorButton::onChooseColor() if (d->modal) { QColor currentColor = d->col; QColorDialog cd(d->col, this); - cd.setOptions(QColorDialog::DontUseNativeDialog); + ParameterGrp::handle group = App::GetApplication().GetUserParameter(). + GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Dialog"); + bool notNativeColorDialog = group->GetBool("DontUseNativeColorDialog", true); + if (notNativeColorDialog) + cd.setOptions(QColorDialog::DontUseNativeDialog); cd.setOption(QColorDialog::ColorDialogOption::ShowAlphaChannel, d->allowTransparency); if (d->autoChange) { @@ -808,7 +812,11 @@ void ColorButton::onChooseColor() if (d->cd.isNull()) { d->old = d->col; d->cd = new QColorDialog(d->col, this); - d->cd->setOptions(QColorDialog::DontUseNativeDialog); + ParameterGrp::handle group = App::GetApplication().GetUserParameter(). + GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Dialog"); + bool notNativeColorDialog = group->GetBool("DontUseNativeColorDialog", true); + if (notNativeColorDialog) + d->cd->setOptions(QColorDialog::DontUseNativeDialog); d->cd->setOption(QColorDialog::ColorDialogOption::ShowAlphaChannel, d->allowTransparency); d->cd->setAttribute(Qt::WA_DeleteOnClose); connect(d->cd, SIGNAL(rejected()),