diff options
author | Liang Qi <liang.qi@qt.io> | 2017-01-14 21:58:48 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-01-14 21:58:48 +0100 |
commit | 537eced61381f0ce1eabdc797bb0dacd11e11d39 (patch) | |
tree | 13ccb774329ca0214e89675e5f1d1ffa638f8ef6 /src/quicktemplates2/qquickdialogbuttonbox.cpp | |
parent | 698cffce2171bed322aa9d0df1fda316c379efda (diff) | |
parent | 6f7852a307c7ebbdb3b6efa00cbf7626b072bbc1 (diff) |
Merge remote-tracking branch 'origin/5.8.0' into 5.8
Change-Id: Ibad627dfcd3389aeddfe08a10d13097c88f081a1
Diffstat (limited to 'src/quicktemplates2/qquickdialogbuttonbox.cpp')
-rw-r--r-- | src/quicktemplates2/qquickdialogbuttonbox.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/quicktemplates2/qquickdialogbuttonbox.cpp b/src/quicktemplates2/qquickdialogbuttonbox.cpp index 0f362fcc..40b1e2c7 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; } |