aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2/qquickswitchdelegate.cpp
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2017-01-06 14:35:21 +0100
committerJani Heikkinen <jani.heikkinen@qt.io>2017-01-12 20:35:59 +0000
commit6f7852a307c7ebbdb3b6efa00cbf7626b072bbc1 (patch)
treec88c82952805f9dcb3fb219a5b8a2a94b5a07f0b /src/quicktemplates2/qquickswitchdelegate.cpp
parentfc083796ad8b02bf9d995ee22b6d60090e1e284d (diff)
Switch(Delegate): fix handle snappingv5.8.0
When Switch is released, nextCheckState() gets called to set the appropriate check state depending on the handle position. If the check state does not change, it must force a position update to avoid that the handle is left somewhere in the middle. Task-number: QTBUG-57944 Change-Id: I872160dafaa7dbf676b026fcc6ba0d0507a91a05 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quicktemplates2/qquickswitchdelegate.cpp')
-rw-r--r--src/quicktemplates2/qquickswitchdelegate.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/quicktemplates2/qquickswitchdelegate.cpp b/src/quicktemplates2/qquickswitchdelegate.cpp
index 81e282d9..e659b927 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()