aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2/qquickdialogbuttonbox.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/quicktemplates2/qquickdialogbuttonbox.cpp')
-rw-r--r--src/quicktemplates2/qquickdialogbuttonbox.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/quicktemplates2/qquickdialogbuttonbox.cpp b/src/quicktemplates2/qquickdialogbuttonbox.cpp
index 10603d58..1e7a5fd7 100644
--- a/src/quicktemplates2/qquickdialogbuttonbox.cpp
+++ b/src/quicktemplates2/qquickdialogbuttonbox.cpp
@@ -500,7 +500,17 @@ void QQuickDialogButtonBox::setStandardButtons(QPlatformDialogHelper::StandardBu
*/
QQuickAbstractButton *QQuickDialogButtonBox::standardButton(QPlatformDialogHelper::StandardButton button) const
{
- Q_UNUSED(button);
+ Q_D(const QQuickDialogButtonBox);
+ if (Q_UNLIKELY(!(d->standardButtons & button)))
+ return nullptr;
+ for (int i = 0, n = count(); i < n; ++i) {
+ QQuickAbstractButton *btn = qobject_cast<QQuickAbstractButton *>(d->itemAt(i));
+ if (Q_LIKELY(btn)) {
+ QQuickDialogButtonBoxAttached *attached = qobject_cast<QQuickDialogButtonBoxAttached *>(qmlAttachedPropertiesObject<QQuickDialogButtonBox>(btn, false));
+ if (attached && QQuickDialogButtonBoxAttachedPrivate::get(attached)->standardButton == button)
+ return btn;
+ }
+ }
return nullptr;
}