diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2017-04-04 17:41:14 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2017-04-05 09:08:08 +0000 |
commit | 1cf6abc8ba5547f12352467db8ce1c3d09921960 (patch) | |
tree | a1fb7e09417bf2dc7d41fa1bd64901e202d04549 /src | |
parent | f5890e07ca8172b05ce8305c65b42531acdb629b (diff) |
Slider: react immediately when using a mouse
The initial drag threshold is a necessary evil on touch to avoid
conflicting with flickables, but leads to bad experience (QTBUG-47081)
when using a mouse. Now that we have separate mouse and touch handling,
we can apply immediate moves when using a mouse, but keep the old
behavior on touch.
Changing the behavior is simple, but auto tests need quite many tweaks
so RangeSlider and Dial will be done separate follow up changes.
[ChangeLog][Important Behavior Changes] Sliders and Dials now react
immediately when using a mouse. Now the initial drag threshold applies
only on touch, to avoid conflicting with flickables.
Task-number: QTBUG-59920
Change-Id: Ifc1e6ed74c7894c3c854c975dff5238278827590
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/quicktemplates2/qquickslider.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/quicktemplates2/qquickslider.cpp b/src/quicktemplates2/qquickslider.cpp index fbf9755d..77e5856c 100644 --- a/src/quicktemplates2/qquickslider.cpp +++ b/src/quicktemplates2/qquickslider.cpp @@ -194,8 +194,6 @@ void QQuickSliderPrivate::handlePress(const QPointF &point) void QQuickSliderPrivate::handleMove(const QPointF &point) { Q_Q(QQuickSlider); - if (!q->keepMouseGrab() && !q->keepTouchGrab()) - return; const qreal oldPos = position; qreal pos = positionAt(point); if (snapMode == QQuickSlider::SnapAlways) @@ -621,6 +619,7 @@ void QQuickSlider::mousePressEvent(QMouseEvent *event) Q_D(QQuickSlider); QQuickControl::mousePressEvent(event); d->handlePress(event->localPos()); + d->handleMove(event->localPos()); } void QQuickSlider::mouseMoveEvent(QMouseEvent *event) @@ -675,7 +674,8 @@ void QQuickSlider::touchEvent(QTouchEvent *event) else setKeepTouchGrab(QQuickWindowPrivate::dragOverThreshold(point.pos().y() - d->pressPoint.y(), Qt::YAxis, &point)); } - d->handleMove(point.pos()); + if (keepTouchGrab()) + d->handleMove(point.pos()); } break; |