summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qplatformdialoghelper.h
diff options
context:
space:
mode:
authorThorbjørn Lund Martsum <tmartsum@gmail.com>2023-04-21 15:13:19 +0200
committerThorbjørn Lund Martsum <tmartsum@gmail.com>2023-05-02 10:37:17 +0200
commit29b2506e8cf0c792821a3ddb28e62080cd66ae28 (patch)
tree46b63701bc4f462c4041439171f3cbea381f4082 /src/gui/kernel/qplatformdialoghelper.h
parent642f799fc6c36c88834a7e2a10904816a962c2cb (diff)
Allow disable native messagebox dialog
The native style may not match the program style and it makes sense to give an option rather than forcing native style. Before it could only be done with setting AA_DontUseNativeDialogs on the app, but it is reasonable to use native file dialogs and Qt styled messageboxes - and it is extremely cumbersome - especially since messageboxes often can start save dialogs. It can look a bit strange that these introduced options has just one option (DontUseNativeDialog) and four functions, but this way it works similar to QColorDialog, QFileDialog and QFontDialog. [ChangeLog][QWidgets][QMessageBox] Added options functionality to QMessagebox. The currently only option available is DontUseNativeDialog. Change-Id: I70282fcfaa66f245f7e679b8897c607bcaff333f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/gui/kernel/qplatformdialoghelper.h')
-rw-r--r--src/gui/kernel/qplatformdialoghelper.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/gui/kernel/qplatformdialoghelper.h b/src/gui/kernel/qplatformdialoghelper.h
index 25543a70b8..fabc4985a3 100644
--- a/src/gui/kernel/qplatformdialoghelper.h
+++ b/src/gui/kernel/qplatformdialoghelper.h
@@ -403,6 +403,11 @@ protected:
~QMessageDialogOptions();
public:
+ // Keep in sync with QMessageBox Option
+ enum class Option : quint8 { DontUseNativeDialog = 0x00000001 };
+ Q_DECLARE_FLAGS(Options, Option);
+ Q_FLAG(Options);
+
// Keep in sync with QMessageBox::Icon
enum StandardIcon { NoIcon, Information, Warning, Critical, Question };
Q_ENUM(StandardIcon)
@@ -428,6 +433,11 @@ public:
void setDetailedText(const QString &text);
QString detailedText() const;
+ void setOption(Option option, bool on = true);
+ bool testOption(Option option) const;
+ void setOptions(Options options);
+ Options options() const;
+
void setStandardButtons(QPlatformDialogHelper::StandardButtons buttons);
QPlatformDialogHelper::StandardButtons standardButtons() const;