diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2022-11-21 13:38:05 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2022-12-04 19:15:37 +0100 |
commit | 31973f3ff32c837fd031d6ed386ebdb2e75cbc1e (patch) | |
tree | 13621ae713bd3751a559b41f066f0a93ac32659f /src/gui | |
parent | 8a18466e38779b63c19e281e92031cebaedbcba5 (diff) |
Teach QErrorMessage to use native dialog helper if available
And implement for macOS. The default modality of the QErrorMessage
on macOS now depends on whether the dialog has a parent or not.
The QErrorMessage must be hidden and re-shown again after each message,
so that the native dialog has a chance to recreate itself.
Change-Id: I474ed35d6271118834fac8e97f6f540a6fb89b8c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qplatformdialoghelper.cpp | 11 | ||||
-rw-r--r-- | src/gui/kernel/qplatformdialoghelper.h | 4 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/gui/kernel/qplatformdialoghelper.cpp b/src/gui/kernel/qplatformdialoghelper.cpp index fbc635cc93..de0d4f43d7 100644 --- a/src/gui/kernel/qplatformdialoghelper.cpp +++ b/src/gui/kernel/qplatformdialoghelper.cpp @@ -776,6 +776,7 @@ public: QList<QMessageDialogOptions::CustomButton> customButtons; int nextCustomButtonId; QPixmap iconPixmap; + bool enableSupressionCheckBox = false; }; QMessageDialogOptions::QMessageDialogOptions(QMessageDialogOptionsPrivate *dd) @@ -906,6 +907,16 @@ const QMessageDialogOptions::CustomButton *QMessageDialogOptions::customButton(i return (i < 0 ? nullptr : &d->customButtons.at(i)); } +void QMessageDialogOptions::setSupressionCheckBoxEnabled(bool enabled) +{ + d->enableSupressionCheckBox = enabled; +} + +bool QMessageDialogOptions::supressionCheckBoxEnabled() const +{ + return d->enableSupressionCheckBox; +} + QPlatformDialogHelper::ButtonRole QPlatformDialogHelper::buttonRole(QPlatformDialogHelper::StandardButton button) { switch (button) { diff --git a/src/gui/kernel/qplatformdialoghelper.h b/src/gui/kernel/qplatformdialoghelper.h index 2d3138270f..b7aa02cc7c 100644 --- a/src/gui/kernel/qplatformdialoghelper.h +++ b/src/gui/kernel/qplatformdialoghelper.h @@ -451,6 +451,9 @@ public: const QList<CustomButton> &customButtons(); const CustomButton *customButton(int id); + void setSupressionCheckBoxEnabled(bool enabled); + bool supressionCheckBoxEnabled() const; + private: QMessageDialogOptionsPrivate *d; }; @@ -464,6 +467,7 @@ public: Q_SIGNALS: void clicked(QPlatformDialogHelper::StandardButton button, QPlatformDialogHelper::ButtonRole role); + void supressionCheckBoxChanged(bool checked); private: QSharedPointer<QMessageDialogOptions> m_options; |