[core] Add new parameter to BaseApp/Preferences/Dialog called DontUseNativeColorDialog, default to true

This commit is contained in:
mwganson
2021-12-24 13:41:54 -06:00
committed by wwmayer
parent 7f0bc597a5
commit 9976b4cf84
2 changed files with 20 additions and 2 deletions

View File

@@ -237,6 +237,11 @@ public:
auto color = item->data(Qt::UserRole).value<QColor>();
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<QColor>();
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();

View File

@@ -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()),