diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2016-12-20 22:28:43 +0100 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-12-21 12:07:22 +0000 |
commit | fed1476148399f4402ce2069874e7c66e834e764 (patch) | |
tree | baac437da4423d7be890c01e7064de04b9bf1cf0 /src/quicktemplates2/qquickswitch.cpp | |
parent | 7aee63b8a5db7721e079e1a3402a3ca6b4b1d06e (diff) |
Add QQuickAbstractButton::buttonChange()
Merge the various virtuals to a single method that takes an enum value
indicating the type of the change. This way we don't need to keep adding
more and more virtuals, but can just extend the enum. The next in line
is ButtonPressedChanged for the upcoming DelayButton.
Change-Id: I40ebf170470790730217aba48c80daff8118dfba
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quicktemplates2/qquickswitch.cpp')
-rw-r--r-- | src/quicktemplates2/qquickswitch.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/quicktemplates2/qquickswitch.cpp b/src/quicktemplates2/qquickswitch.cpp index b967fe56..4c2268ce 100644 --- a/src/quicktemplates2/qquickswitch.cpp +++ b/src/quicktemplates2/qquickswitch.cpp @@ -192,10 +192,13 @@ void QQuickSwitch::nextCheckState() 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 |