diff options
Diffstat (limited to 'src/quicktemplates2/qquickswitch.cpp')
-rw-r--r-- | src/quicktemplates2/qquickswitch.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/quicktemplates2/qquickswitch.cpp b/src/quicktemplates2/qquickswitch.cpp index fa1b5463..15f8c4ec 100644 --- a/src/quicktemplates2/qquickswitch.cpp +++ b/src/quicktemplates2/qquickswitch.cpp @@ -187,15 +187,18 @@ void QQuickSwitch::nextCheckState() { Q_D(QQuickSwitch); if (keepMouseGrab()) - setChecked(d->position > 0.5); + d->toggle(d->position > 0.5); else QQuickAbstractButton::nextCheckState(); } -void QQuickSwitch::checkStateSet() +void QQuickSwitch::buttonChange(ButtonChange change) { Q_D(QQuickSwitch); - setPosition(d->checked ? 1.0 : 0.0); + if (change == ButtonCheckedChange) + setPosition(d->checked ? 1.0 : 0.0); + else + QQuickAbstractButton::buttonChange(change); } QT_END_NAMESPACE |