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