summaryrefslogtreecommitdiffstats
path: root/src/widgets/dialogs/qmessagebox.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/dialogs/qmessagebox.cpp')
-rw-r--r--src/widgets/dialogs/qmessagebox.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp
index e91a2625cfd..9ff2b5159bb 100644
--- a/src/widgets/dialogs/qmessagebox.cpp
+++ b/src/widgets/dialogs/qmessagebox.cpp
@@ -2782,9 +2782,14 @@ void QMessageBoxPrivate::initHelper(QPlatformDialogHelper *h)
auto *messageDialogHelper = static_cast<QPlatformMessageDialogHelper *>(h);
QObjectPrivate::connect(messageDialogHelper, &QPlatformMessageDialogHelper::clicked,
this, &QMessageBoxPrivate::helperClicked);
+ // Forward state via lambda, so that we can handle addition and removal
+ // of checkbox via setCheckBox() after initializing helper.
QObject::connect(messageDialogHelper, &QPlatformMessageDialogHelper::checkBoxStateChanged,
- checkbox, &QCheckBox::setCheckState);
-
+ q_ptr, [this](Qt::CheckState state) {
+ if (checkbox)
+ checkbox->setCheckState(state);
+ }
+ );
messageDialogHelper->setOptions(options);
}