diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/imports/controls/material/ComboBox.qml | 2 | ||||
-rw-r--r-- | src/quicktemplates2/qquickdialogbuttonbox.cpp | 12 | ||||
-rw-r--r-- | src/quicktemplates2/qquickswitch.cpp | 8 | ||||
-rw-r--r-- | src/quicktemplates2/qquickswitchdelegate.cpp | 8 |
4 files changed, 25 insertions, 5 deletions
diff --git a/src/imports/controls/material/ComboBox.qml b/src/imports/controls/material/ComboBox.qml index fbddb32c..c38c2b01 100644 --- a/src/imports/controls/material/ComboBox.qml +++ b/src/imports/controls/material/ComboBox.qml @@ -74,6 +74,8 @@ T.ComboBox { x: control.mirrored ? control.leftPadding : control.width - width - control.rightPadding y: control.topPadding + (control.availableHeight - height) / 2 source: "image://material/drop-indicator/" + (control.enabled ? control.Material.foreground : control.Material.hintTextColor) + sourceSize.width: width + sourceSize.height: height } contentItem: Text { 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; } diff --git a/src/quicktemplates2/qquickswitch.cpp b/src/quicktemplates2/qquickswitch.cpp index fa1b5463..c1a7d34a 100644 --- a/src/quicktemplates2/qquickswitch.cpp +++ b/src/quicktemplates2/qquickswitch.cpp @@ -186,10 +186,14 @@ void QQuickSwitch::mirrorChange() void QQuickSwitch::nextCheckState() { Q_D(QQuickSwitch); - if (keepMouseGrab()) + if (keepMouseGrab()) { setChecked(d->position > 0.5); - else + // the checked state might not change => force a position update to + // avoid that the handle is left somewhere in the middle (QTBUG-57944) + checkStateSet(); + } else { QQuickAbstractButton::nextCheckState(); + } } void QQuickSwitch::checkStateSet() diff --git a/src/quicktemplates2/qquickswitchdelegate.cpp b/src/quicktemplates2/qquickswitchdelegate.cpp index 72b4803d..d0d14ae5 100644 --- a/src/quicktemplates2/qquickswitchdelegate.cpp +++ b/src/quicktemplates2/qquickswitchdelegate.cpp @@ -191,10 +191,14 @@ void QQuickSwitchDelegate::mirrorChange() void QQuickSwitchDelegate::nextCheckState() { Q_D(QQuickSwitchDelegate); - if (keepMouseGrab()) + if (keepMouseGrab()) { setChecked(d->position > 0.5); - else + // the checked state might not change => force a position update to + // avoid that the handle is left somewhere in the middle (QTBUG-57944) + checkStateSet(); + } else { QQuickItemDelegate::nextCheckState(); + } } void QQuickSwitchDelegate::checkStateSet() |