aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickflickable_p_p.h
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@digia.com>2015-01-27 12:58:42 +0100
committerShawn Rutledge <shawn.rutledge@digia.com>2015-02-16 11:49:46 +0000
commita6ed830f4779e218b8e8f8d82dc4aa9b4b4528a1 (patch)
tree85237d83dd3a105fa167534ca6b2526dc69ff83c /src/quick/items/qquickflickable_p_p.h
parent428b92583ee2102c7ef16776a9b7785df7ff4e2c (diff)
Flickable: use wheel event pixel deltas when available
Flickable can now handle wheel events which come from touchpads, providing pixel deltas instead of angle deltas. It will interpret them as distance to flick, rather than using an average-velocity physics model as it does when handling events from a physical mouse wheel. This enables much finer control and limits the tendency to "zing" way out of bounds accidentally. It is achieved by refactoring the direct-drag code which is needed for mouse dragging and for touchpad gesture dragging (and eventually touchscreen dragging) into a new internal drag() method. [ChangeLog][QtQuick][Flickable] Flickable handles pixel deltas from trackpad gestures as drags, for a more native feel Task-number: QTBUG-22407 Change-Id: Ia613ddb25f46d452603f7cb567b74e80c95a346c Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
Diffstat (limited to 'src/quick/items/qquickflickable_p_p.h')
-rw-r--r--src/quick/items/qquickflickable_p_p.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/quick/items/qquickflickable_p_p.h b/src/quick/items/qquickflickable_p_p.h
index fa49c725f5..d7148ca57a 100644
--- a/src/quick/items/qquickflickable_p_p.h
+++ b/src/quick/items/qquickflickable_p_p.h
@@ -93,7 +93,7 @@ public:
AxisData(QQuickFlickablePrivate *fp, void (QQuickFlickablePrivate::*func)(qreal))
: move(fp, func)
, transitionToBounds(0)
- , viewSize(-1), lastPos(0), velocity(0), startMargin(0), endMargin(0)
+ , viewSize(-1), lastPos(0), previousDragDelta(0), velocity(0), startMargin(0), endMargin(0)
, origin(0)
, transitionTo(0)
, continuousFlickVelocity(0), velocityTime(), vTime(0)
@@ -135,6 +135,7 @@ public:
qreal dragStartOffset;
qreal dragMinBound;
qreal dragMaxBound;
+ qreal previousDragDelta;
qreal velocity;
qreal flickTarget;
qreal startMargin;
@@ -151,6 +152,7 @@ public:
bool transitionToSet : 1;
bool fixingUp : 1;
bool inOvershoot : 1;
+ bool inRebound : 1;
bool moving : 1;
bool flicking : 1;
bool dragging : 1;
@@ -205,6 +207,7 @@ public:
bool vMoved : 1;
bool stealMouse : 1;
bool pressed : 1;
+ bool scrollingPhase : 1;
bool interactive : 1;
bool calcVelocity : 1;
bool pixelAligned : 1;
@@ -214,6 +217,7 @@ public:
qint64 lastPressTime;
QPointF lastPos;
QPointF pressPos;
+ QVector2D accumulatedWheelPixelDelta;
qreal deceleration;
qreal maxVelocity;
qreal reportedVelocitySmoothing;
@@ -244,7 +248,12 @@ public:
void handleMouseMoveEvent(QMouseEvent *);
void handleMouseReleaseEvent(QMouseEvent *);
+ void maybeBeginDrag(qint64 currentTimestamp, const QPointF &pressPosn);
+ void drag(qint64 currentTimestamp, QEvent::Type eventType, const QPointF &localPos,
+ const QVector2D &deltas, bool overThreshold, bool momentum, const QVector2D &velocity);
+
qint64 computeCurrentTime(QInputEvent *event);
+ qreal devicePixelRatio();
// flickableData property
static void data_append(QQmlListProperty<QObject> *, QObject *);