aboutsummaryrefslogtreecommitdiffstats
path: root/src/templates/qquickswitch.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/templates/qquickswitch.cpp')
-rw-r--r--src/templates/qquickswitch.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/templates/qquickswitch.cpp b/src/templates/qquickswitch.cpp
index 05422d8d..79d9735c 100644
--- a/src/templates/qquickswitch.cpp
+++ b/src/templates/qquickswitch.cpp
@@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE
\instantiates QQuickSwitch
\inqmlmodule Qt.labs.controls
\ingroup qtlabscontrols-buttons
- \brief A switch control.
+ \brief An option button that can be toggled on or off.
\image qtlabscontrols-switch.gif
@@ -188,11 +188,12 @@ void QQuickSwitch::setPosition(qreal position)
{
Q_D(QQuickSwitch);
position = qBound<qreal>(0.0, position, 1.0);
- if (d->position != position) {
- d->position = position;
- emit positionChanged();
- emit visualPositionChanged();
- }
+ if (qFuzzyCompare(d->position, position))
+ return;
+
+ d->position = position;
+ emit positionChanged();
+ emit visualPositionChanged();
}
/*!