aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2/qquickswitch.cpp
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-09-19 15:19:40 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2016-09-19 16:36:55 +0000
commit935974e174d87f9bf10a56d14bb73ade726d827a (patch)
tree03bfc3f55da39c4c2202c9295a09623400bfdd77 /src/quicktemplates2/qquickswitch.cpp
parentfbe806c544a45c83f091109e04fab5d86620183f (diff)
Fix Switch to stay pressed as appropriate
Switch is a special type of button that should stay pressed (similarly to Slider) even if the finger slips outside the bounds of the control. It was doing that only when dragged from the handle, not when dragged from the background. Change-Id: I462c66cfe2e67fc3c95215ffeafe3e5771174418 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quicktemplates2/qquickswitch.cpp')
-rw-r--r--src/quicktemplates2/qquickswitch.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/quicktemplates2/qquickswitch.cpp b/src/quicktemplates2/qquickswitch.cpp
index 37ae53f0..7941bf69 100644
--- a/src/quicktemplates2/qquickswitch.cpp
+++ b/src/quicktemplates2/qquickswitch.cpp
@@ -184,6 +184,8 @@ bool QQuickSwitchPrivate::handleMouseUngrabEvent(QQuickItem *child)
QQuickSwitch::QQuickSwitch(QQuickItem *parent) :
QQuickAbstractButton(*(new QQuickSwitchPrivate), parent)
{
+ Q_D(QQuickSwitch);
+ d->keepPressed = true;
setCheckable(true);
setFiltersChildMouseEvents(true);
QObjectPrivate::connect(this, &QQuickAbstractButton::checkedChanged, d_func(), &QQuickSwitchPrivate::updatePosition);