diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2016-12-20 09:37:14 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2016-12-20 09:37:14 +0100 |
commit | c07610b208268e6b6b952d634a6540ff66a0a8a8 (patch) | |
tree | df8f0a71db8e1d3a6144e35468125c2b263dc372 /src/quick/items/qquickwindow_p.h | |
parent | 6f94828e8f1865259ff1b1cd7fda5064ffd9576c (diff) | |
parent | c4eefa4a8d6d3e95062deb78229940460a7ef605 (diff) |
Merge branch remote-tracking branch 'origin/dev' into wip/pointerhandler
Change-Id: I9ed2e696108f11c9153012fcf092541fd0e0d7c8
Diffstat (limited to 'src/quick/items/qquickwindow_p.h')
-rw-r--r-- | src/quick/items/qquickwindow_p.h | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/src/quick/items/qquickwindow_p.h b/src/quick/items/qquickwindow_p.h index cedfd765da..30e3b71d0a 100644 --- a/src/quick/items/qquickwindow_p.h +++ b/src/quick/items/qquickwindow_p.h @@ -66,6 +66,8 @@ #include <qopenglcontext.h> #include <QtGui/qopenglframebufferobject.h> #include <QtGui/qevent.h> +#include <QtGui/qstylehints.h> +#include <QtGui/qguiapplication.h> QT_BEGIN_NAMESPACE @@ -125,10 +127,10 @@ public: void deliverKeyEvent(QKeyEvent *e); // Keeps track of the item currently receiving mouse events -#ifndef QT_NO_CURSOR +#if QT_CONFIG(cursor) QQuickItem *cursorItem; #endif -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) QQuickDragGrabber *dragGrabber; #endif int touchMouseId; @@ -146,10 +148,10 @@ public: static QMouseEvent *cloneMouseEvent(QMouseEvent *event, QPointF *transformedLocalPos = 0); void deliverMouseEvent(QQuickPointerMouseEvent *pointerEvent); bool sendFilteredMouseEvent(QQuickItem *, QQuickItem *, QEvent *, QSet<QQuickItem *> *); -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) bool deliverWheelEvent(QQuickItem *, QWheelEvent *); #endif -#ifndef QT_NO_GESTURES +#if QT_CONFIG(gestures) bool deliverNativeGestureEvent(QQuickItem *, QNativeGestureEvent *); #endif @@ -179,11 +181,11 @@ public: Qt::KeyboardModifiers modifiers, ulong timestamp, bool accepted); bool clearHover(ulong timestamp = 0); -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) void deliverDragEvent(QQuickDragGrabber *, QEvent *); bool deliverDragEvent(QQuickDragGrabber *, QQuickItem *, QDragMoveEvent *); #endif -#ifndef QT_NO_CURSOR +#if QT_CONFIG(cursor) void updateCursor(const QPointF &scenePos); QQuickItem *findCursorItem(QQuickItem *item, const QPointF &scenePos); #endif @@ -270,8 +272,19 @@ public: static bool defaultAlphaBuffer; static bool dragOverThreshold(qreal d, Qt::Axis axis, QMouseEvent *event, int startDragThreshold = -1); - static bool dragOverThreshold(qreal d, Qt::Axis axis, const QTouchEvent::TouchPoint *tp, int startDragThreshold = -1); - static bool dragOverThreshold(qreal d, Qt::Axis axis, const QQuickEventPoint *tp, int startDragThreshold = -1); + + template <typename TEventPoint> + static bool dragOverThreshold(qreal d, Qt::Axis axis, const TEventPoint *p, int startDragThreshold = -1) + { + QStyleHints *styleHints = qApp->styleHints(); + bool overThreshold = qAbs(d) > (startDragThreshold >= 0 ? startDragThreshold : styleHints->startDragDistance()); + const bool dragVelocityLimitAvailable = (styleHints->startDragVelocity() > 0); + if (!overThreshold && dragVelocityLimitAvailable) { + qreal velocity = axis == Qt::XAxis ? p->velocity().x() : p->velocity().y(); + overThreshold |= qAbs(velocity) > styleHints->startDragVelocity(); + } + return overThreshold; + } // data property static void data_append(QQmlListProperty<QObject> *, QObject *); |