From e579076bb36e6594003b2ade7f3d062944ef6f47 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 16 Nov 2016 14:22:36 +0100 Subject: Get rid of most QT_NO_FOO usages Instead use QT_CONFIG(foo). This change actually detected a few mis-spelled macros and invalid usages. Change-Id: I06ac327098dd1a458e6bc379d637b8e2dac52f85 Reviewed-by: Simon Hausmann --- src/quick/items/qquickwindow_p.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/quick/items/qquickwindow_p.h') diff --git a/src/quick/items/qquickwindow_p.h b/src/quick/items/qquickwindow_p.h index 3328eb65c4..32a6939868 100644 --- a/src/quick/items/qquickwindow_p.h +++ b/src/quick/items/qquickwindow_p.h @@ -125,10 +125,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 +146,10 @@ public: static QMouseEvent *cloneMouseEvent(QMouseEvent *event, QPointF *transformedLocalPos = 0); void deliverMouseEvent(QQuickPointerMouseEvent *pointerEvent); bool sendFilteredMouseEvent(QQuickItem *, QQuickItem *, QEvent *, QSet *); -#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 +179,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 -- cgit v1.2.3 From 558bb0e3bbbd3eaca52b02946374f2106c3a3872 Mon Sep 17 00:00:00 2001 From: Jan Arve Saether Date: Wed, 7 Dec 2016 14:19:54 +0100 Subject: QQuickWindowPrivate::dragOverThreshold(): ignore zero velocity threshold MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, this would trigger a drag even if the touch point was quite steady, since a rather steady finger could report a very small velocity (usually between 0 and 1). Change so that it will ignore velocity if it's not positive. At the same time convert it to a template function since we want to also use this for QQuickEventPoint later on. Change-Id: Ibb2210813707399ae84e3422718c995897891060 Reviewed-by: Jan Arve Sæther Reviewed-by: Shawn Rutledge --- src/quick/items/qquickwindow_p.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/quick/items/qquickwindow_p.h') diff --git a/src/quick/items/qquickwindow_p.h b/src/quick/items/qquickwindow_p.h index 32a6939868..829fe53458 100644 --- a/src/quick/items/qquickwindow_p.h +++ b/src/quick/items/qquickwindow_p.h @@ -66,6 +66,8 @@ #include #include #include +#include +#include QT_BEGIN_NAMESPACE @@ -270,7 +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); + + template + 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 *); -- cgit v1.2.3