diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2023-03-08 10:27:48 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2023-03-09 09:41:33 +0100 |
commit | a0313c85a9b8ab6ba0ec273f0c8638e2f7b8cc18 (patch) | |
tree | 514e55d3c4bbd60e766b78db22f84107d9b9bae9 /src/gui/kernel/qplatformdialoghelper.h | |
parent | 9255820ad591645897d261b795b5649b8d9a313f (diff) |
Plumb QMessageBox::setCheckBox() through QPlatformMessageDialogHelper
Without this plumbing we have no way of knowing if the QMessageBox
has a checkbox set, and can't decide to skip the native dialog,
leaving the user without the expected checkbox.
As the suppression checkbox on macOS can be customized, we can use
this plumbing to actually provide native dialog support for generic
check boxes.
This mechanism can also be used by QErrorMessage, which now matches
behavior between native and non-native dialogs in terms of the label
of the checkbox and its initial state. We might want to tweak this
in the future, since user's might expect the suppression label and
state to match the system default, but that's something we can
expose from the platform theme if so, and should apply equally
to the non-native dialog.
Fixes: QTBUG-111803
Pick-to: 6.5.0 6.5
Change-Id: Ied9fc34383fe79fbd8437592ad1c1993b9396178
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/gui/kernel/qplatformdialoghelper.h')
-rw-r--r-- | src/gui/kernel/qplatformdialoghelper.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/gui/kernel/qplatformdialoghelper.h b/src/gui/kernel/qplatformdialoghelper.h index 43d3dfe358..25543a70b8 100644 --- a/src/gui/kernel/qplatformdialoghelper.h +++ b/src/gui/kernel/qplatformdialoghelper.h @@ -451,8 +451,9 @@ public: const QList<CustomButton> &customButtons(); const CustomButton *customButton(int id); - void setSupressionCheckBoxEnabled(bool enabled); - bool supressionCheckBoxEnabled() const; + void setCheckBox(const QString &label, Qt::CheckState state); + QString checkBoxLabel() const; + Qt::CheckState checkBoxState() const; private: QMessageDialogOptionsPrivate *d; @@ -467,7 +468,7 @@ public: Q_SIGNALS: void clicked(QPlatformDialogHelper::StandardButton button, QPlatformDialogHelper::ButtonRole role); - void supressionCheckBoxChanged(bool checked); + void checkBoxStateChanged(Qt::CheckState state); private: QSharedPointer<QMessageDialogOptions> m_options; |