Gui: move options to use native or Qt dialogs to class DialogOptions

This commit is contained in:
wmayer
2021-12-30 17:31:00 +01:00
parent 9976b4cf84
commit edd1d3e8e5
4 changed files with 28 additions and 22 deletions

View File

@@ -45,6 +45,7 @@
#include "Selection.h"
#include "BitmapFactory.h"
#include "Command.h"
#include "FileDialog.h"
#include <App/Document.h>
#include <App/DocumentObject.h>
@@ -237,10 +238,7 @@ 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)
if (DialogOptions::dontUseNativeColorDialog())
cd.setOptions(QColorDialog::DontUseNativeDialog);
if (cd.exec()!=QDialog::Accepted || color==cd.selectedColor())
return;
@@ -431,10 +429,7 @@ 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)
if (DialogOptions::dontUseNativeColorDialog())
cd.setOptions(QColorDialog::DontUseNativeDialog);
if (cd.exec()!=QDialog::Accepted)
return;