diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2018-05-09 09:21:54 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2018-05-16 10:35:09 +0000 |
commit | c248a32fe69dfe1c685105d0c6aeaeb15d7ba29f (patch) | |
tree | b1f74f88881177d3a70106f2ba9a05194f553bd8 /src | |
parent | 7dcada48d2435e8ceb0cc8a6771f79b76979e11f (diff) |
Move QQuickHandlerPoint into its own header and cpp files
...in anticipation of needing it in QQuickMultiPointHandler.
Change-Id: Id98f2da34ee12b4cea3ba58550b446bfc989da1b
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/quick/handlers/handlers.pri | 2 | ||||
-rw-r--r-- | src/quick/handlers/qquickhandlerpoint.cpp | 254 | ||||
-rw-r--r-- | src/quick/handlers/qquickhandlerpoint_p.h | 114 | ||||
-rw-r--r-- | src/quick/handlers/qquicksinglepointhandler.cpp | 211 | ||||
-rw-r--r-- | src/quick/handlers/qquicksinglepointhandler_p.h | 54 |
5 files changed, 373 insertions, 262 deletions
diff --git a/src/quick/handlers/handlers.pri b/src/quick/handlers/handlers.pri index aed74241d2..23ed65cbc4 100644 --- a/src/quick/handlers/handlers.pri +++ b/src/quick/handlers/handlers.pri @@ -1,5 +1,6 @@ HEADERS += \ $$PWD/qquickdraghandler_p.h \ + $$PWD/qquickhandlerpoint_p.h \ $$PWD/qquickhandlersmodule_p.h \ $$PWD/qquickmultipointhandler_p.h \ $$PWD/qquickpinchhandler_p.h \ @@ -12,6 +13,7 @@ HEADERS += \ SOURCES += \ $$PWD/qquickdraghandler.cpp \ + $$PWD/qquickhandlerpoint.cpp \ $$PWD/qquickhandlersmodule.cpp \ $$PWD/qquickmultipointhandler.cpp \ $$PWD/qquickpinchhandler.cpp \ diff --git a/src/quick/handlers/qquickhandlerpoint.cpp b/src/quick/handlers/qquickhandlerpoint.cpp new file mode 100644 index 0000000000..45c85f88fc --- /dev/null +++ b/src/quick/handlers/qquickhandlerpoint.cpp @@ -0,0 +1,254 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQuick module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qquickhandlerpoint_p.h" + +QT_BEGIN_NAMESPACE +Q_DECLARE_LOGGING_CATEGORY(DBG_TOUCH_TARGET) + +/*! + \qmltype HandlerPoint + \instantiates QQuickHandlerPoint + \inqmlmodule Qt.labs.handlers + \ingroup qtquick-handlers + \brief An event point + + A QML representation of a QQuickEventPoint. + + It's possible to make bindings to properties of a \l SinglePointHandler's + current point. For example: + + \snippet pointerHandlers/dragHandlerNullTarget.qml 0 + + The point is kept up-to-date when the DragHandler is actively responding to + an EventPoint; but when the point is released, or the current point is + being handled by a different handler, \c position.x and \c position.y are 0. + + \note This is practically identical to QtQuick::EventPoint; however an + EventPoint is a long-lived QObject which is invalidated between gestures + and reused for subsequent event deliveries. Continuous bindings to its + properties are not possible, and an individual handler cannot rely on it + outside the period when that point is part of an active gesture which that + handler is handling. HandlerPoint is a Q_GADGET that the handler owns. + This allows you to make lifetime bindings to its properties. + + \sa SinglePointHandler::point +*/ + +QQuickHandlerPoint::QQuickHandlerPoint() + : m_id(0) + , m_rotation(0) + , m_pressure(0) +{} + +void QQuickHandlerPoint::reset() +{ + m_id = 0; + m_uniqueId = QPointingDeviceUniqueId(); + m_position = QPointF(); + m_scenePosition = QPointF(); + m_pressPosition = QPointF(); + m_scenePressPosition = QPointF(); + m_sceneGrabPosition = QPointF(); + m_velocity = QVector2D(); + m_rotation = 0; + m_pressure = 0; + m_ellipseDiameters = QSizeF(); + m_pressedButtons = Qt::NoButton; +} + +/*! + \readonly + \qmlproperty int QtQuick::HandlerPoint::id + \brief The ID number of the point + + During a touch gesture, from the time that the first finger is pressed + until the last finger is released, each touchpoint will have a unique ID + number. Likewise, if input from multiple devices occurs (for example + simultaneous mouse and touch presses), all the current event points from + all the devices will have unique IDs. + + \note Do not assume that id numbers start at zero or that they are + sequential. Such an assumption is often false due to the way the underlying + drivers work. + + \sa QTouchEvent::TouchPoint::id +*/ + +/*! + \readonly + \qmlproperty PointingDeviceUniqueId QtQuick::HandlerPoint::uniqueId + \brief The unique ID of the point, if any + + This is normally empty, because touchscreens cannot uniquely identify fingers. + + On some types of touchscreens, especially those using TUIO drivers, + it's possible to use recognizable physical tokens (fiducial objects) + in addition to fingers. So if this point is a touch point, and + uniqueId is set, it is the identifier for such an object. + + On a graphics tablet, each type of stylus or other tool often has a unique + ID or serial number, which can be useful to respond in different ways to + different tools. + + Interpreting the contents of this ID requires knowledge of the hardware and + drivers in use. + + \sa QTabletEvent::uniqueId, QtQuick::TouchPoint::uniqueId, QtQuick::EventTouchPoint::uniqueId +*/ + +/*! + \readonly + \qmlproperty QPointF QtQuick::HandlerPoint::position + \brief The position within the \c parent Item + + This is the position of the event point relative to the bounds of + the \l {PointerHandler::parent} {parent}. +*/ + +/*! + \readonly + \qmlproperty QPointF QtQuick::HandlerPoint::scenePosition + \brief The position within the scene + + This is the position of the event point relative to the bounds of the Qt + Quick scene (typically the whole window). +*/ + +/*! + \readonly + \qmlproperty QPointF QtQuick::HandlerPoint::pressPosition + \brief The pressed position within the \c parent Item + + This is the position at which this point was pressed, relative to the + bounds of the \l {PointerHandler::parent} {parent}. +*/ + +/*! + \readonly + \qmlproperty QPointF QtQuick::HandlerPoint::scenePressPosition + \brief The pressed position within the scene + + This is the position at which this point was pressed, in the coordinate + system of the \l {Qt Quick Scene Graph}{scene graph}. +*/ + +/*! + \readonly + \qmlproperty QPointF QtQuick::HandlerPoint::sceneGrabPosition + \brief The grabbed position within the scene + + If this point has been grabbed by a Pointer Handler or an Item, it means + that object has taken sole responsibility for handling the movement and the + release if this point. In that case, this is the position at which the grab + occurred, in the coordinate system of the \l {Qt Quick Scene Graph}{scene graph}. +*/ + +/*! + \readonly + \qmlproperty enum QtQuick::HandlerPoint::pressedButtons + \brief Which mouse or stylus buttons are currently pressed + + \sa MouseArea::pressedButtons +*/ + +/*! + \readonly + \qmlproperty QVector2D QtQuick::HandlerPoint::velocity + \brief A vector representing the average speed and direction of movement + + This is a velocity vector pointing in the direction of movement, in logical + pixels per second. It has x and y components, at least one of which will be + nonzero when this point is in motion. It holds the average recent velocity: + how fast and in which direction the event point has been moving recently. + + \sa QtQuick::EventPoint::velocity, QtQuick::TouchPoint::velocity, QTouchEvent::TouchPoint::velocity +*/ + +/*! + \readonly + \qmlproperty qreal QtQuick::HandlerPoint::rotation + + This property holds the rotation angle of the stylus on a graphics tablet + or the contact patch of a touchpoint on a touchscreen. + + It is valid only with certain tablet stylus devices and touchscreens that + can measure the rotation angle. Otherwise, it will be zero. +*/ + +/*! + \readonly + \qmlproperty qreal QtQuick::HandlerPoint::pressure + + This property tells how hard the user is pressing the stylus on a graphics + tablet or the finger against a touchscreen, in the range from \c 0 (no + measurable pressure) to \c 1.0 (maximum pressure which the device can + measure). + + It is valid only with certain tablets and touchscreens that can measure + pressure. Otherwise, it will be zero. +*/ + +/*! + \readonly + \qmlproperty size QtQuick::HandlerPoint::ellipseDiameters + + This property holds the diameters of the contact patch, if the event + comes from a touchpoint and the device provides this information. + + A touchpoint is modeled as an elliptical area where the finger is pressed + against the touchscreen. (In fact, it could also be modeled as a bitmap; + but in that case we expect an elliptical bounding estimate to be fitted to + the contact patch before the event is sent.) The harder the user presses, + the larger the contact patch; so, these diameters provide an alternate way + of detecting pressure, in case the device does not include a separate + pressure sensor. The ellipse is centered on \l scenePosition (\l position + in the PointerHandler's Item's local coordinates). The \l rotation property + provides the rotation of the ellipse, if known. It is expected that if the + \l rotation is zero, the \l {QSize::height}{height} is the larger dimension + (the major axis), because of the usual hand position, reaching upward or + outward across the surface. + + If the contact patch is unknown, or the device is not a touchscreen, + these values will be zero. + + \sa QtQuick::EventTouchPoint::ellipseDiameters, QtQuick::TouchPoint::ellipseDiameters, QTouchEvent::TouchPoint::ellipseDiameters +*/ + +QT_END_NAMESPACE diff --git a/src/quick/handlers/qquickhandlerpoint_p.h b/src/quick/handlers/qquickhandlerpoint_p.h new file mode 100644 index 0000000000..b390b9b6f7 --- /dev/null +++ b/src/quick/handlers/qquickhandlerpoint_p.h @@ -0,0 +1,114 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQuick module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QQUICKHANDLERPOINT_H +#define QQUICKHANDLERPOINT_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qquickpointerdevicehandler_p.h" + +QT_BEGIN_NAMESPACE + +class QQuickMultiPointHandler; +class QQuickSinglePointHandler; + +class Q_QUICK_PRIVATE_EXPORT QQuickHandlerPoint { + Q_GADGET + Q_PROPERTY(int id READ id) + Q_PROPERTY(QPointingDeviceUniqueId uniqueId READ uniqueId) + Q_PROPERTY(QPointF position READ position) + Q_PROPERTY(QPointF scenePosition READ scenePosition) + Q_PROPERTY(QPointF pressPosition READ pressPosition) + Q_PROPERTY(QPointF scenePressPosition READ scenePressPosition) + Q_PROPERTY(QPointF sceneGrabPosition READ sceneGrabPosition) + Q_PROPERTY(Qt::MouseButtons pressedButtons READ pressedButtons) + Q_PROPERTY(QVector2D velocity READ velocity) + Q_PROPERTY(qreal rotation READ rotation) + Q_PROPERTY(qreal pressure READ pressure) + Q_PROPERTY(QSizeF ellipseDiameters READ ellipseDiameters) + +public: + QQuickHandlerPoint(); + + int id() const { return m_id; } + Qt::MouseButtons pressedButtons() const { return m_pressedButtons; } + QPointF pressPosition() const { return m_pressPosition; } + QPointF scenePressPosition() const { return m_scenePressPosition; } + QPointF sceneGrabPosition() const { return m_sceneGrabPosition; } + QPointF position() const { return m_position; } + QPointF scenePosition() const { return m_scenePosition; } + QVector2D velocity() const { return m_velocity; } + qreal rotation() const { return m_rotation; } + qreal pressure() const { return m_pressure; } + QSizeF ellipseDiameters() const { return m_ellipseDiameters; } + QPointingDeviceUniqueId uniqueId() const { return m_uniqueId; } + +private: + void reset(); + int m_id; + QPointingDeviceUniqueId m_uniqueId; + Qt::MouseButtons m_pressedButtons; + QPointF m_position; + QPointF m_scenePosition; + QPointF m_pressPosition; + QPointF m_scenePressPosition; + QPointF m_sceneGrabPosition; + QVector2D m_velocity; + qreal m_rotation; + qreal m_pressure; + QSizeF m_ellipseDiameters; + friend class QQuickMultiPointHandler; + friend class QQuickSinglePointHandler; +}; + +QT_END_NAMESPACE + +QML_DECLARE_TYPE(QQuickHandlerPoint) + +#endif // QQUICKHANDLERPOINT_H diff --git a/src/quick/handlers/qquicksinglepointhandler.cpp b/src/quick/handlers/qquicksinglepointhandler.cpp index 1a5537b732..5510813cce 100644 --- a/src/quick/handlers/qquicksinglepointhandler.cpp +++ b/src/quick/handlers/qquicksinglepointhandler.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2018 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtQuick module of the Qt Toolkit. @@ -264,213 +264,4 @@ void QQuickSinglePointHandler::reset() handled, this object is reset to default values (all coordinates are 0). */ -/*! - \qmltype HandlerPoint - \instantiates QQuickHandlerPoint - \inqmlmodule Qt.labs.handlers - \ingroup qtquick-handlers - \brief An event point - - A QML representation of a QQuickEventPoint. - - It's possible to make bindings to properties of a \l SinglePointHandler's - current point. For example: - - \snippet pointerHandlers/dragHandlerNullTarget.qml 0 - - The point is kept up-to-date when the DragHandler is actively responding to - an EventPoint; but when the point is released, or the current point is - being handled by a different handler, \c position.x and \c position.y are 0. - - \note This is practically identical to QtQuick::EventPoint; however an - EventPoint is a long-lived QObject which is invalidated between gestures - and reused for subsequent event deliveries. Continuous bindings to its - properties are not possible, and an individual handler cannot rely on it - outside the period when that point is part of an active gesture which that - handler is handling. HandlerPoint is a Q_GADGET that the handler owns. - This allows you to make lifetime bindings to its properties. - - \sa SinglePointHandler::point -*/ - -QQuickHandlerPoint::QQuickHandlerPoint() - : m_id(0) - , m_rotation(0) - , m_pressure(0) -{} - -void QQuickHandlerPoint::reset() -{ - m_id = 0; - m_uniqueId = QPointingDeviceUniqueId(); - m_position = QPointF(); - m_scenePosition = QPointF(); - m_pressPosition = QPointF(); - m_scenePressPosition = QPointF(); - m_sceneGrabPosition = QPointF(); - m_velocity = QVector2D(); - m_rotation = 0; - m_pressure = 0; - m_ellipseDiameters = QSizeF(); - m_pressedButtons = Qt::NoButton; -} - -/*! - \readonly - \qmlproperty int QtQuick::HandlerPoint::id - \brief The ID number of the point - - During a touch gesture, from the time that the first finger is pressed - until the last finger is released, each touchpoint will have a unique ID - number. Likewise, if input from multiple devices occurs (for example - simultaneous mouse and touch presses), all the current event points from - all the devices will have unique IDs. - - \note Do not assume that id numbers start at zero or that they are - sequential. Such an assumption is often false due to the way the underlying - drivers work. - - \sa QTouchEvent::TouchPoint::id -*/ - -/*! - \readonly - \qmlproperty PointingDeviceUniqueId QtQuick::HandlerPoint::uniqueId - \brief The unique ID of the point, if any - - This is normally empty, because touchscreens cannot uniquely identify fingers. - - On some types of touchscreens, especially those using TUIO drivers, - it's possible to use recognizable physical tokens (fiducial objects) - in addition to fingers. So if this point is a touch point, and - uniqueId is set, it is the identifier for such an object. - - On a graphics tablet, each type of stylus or other tool often has a unique - ID or serial number, which can be useful to respond in different ways to - different tools. - - Interpreting the contents of this ID requires knowledge of the hardware and - drivers in use. - - \sa QTabletEvent::uniqueId, QtQuick::TouchPoint::uniqueId, QtQuick::EventTouchPoint::uniqueId -*/ - -/*! - \readonly - \qmlproperty QPointF QtQuick::HandlerPoint::position - \brief The position within the \c parent Item - - This is the position of the event point relative to the bounds of - the \l {PointerHandler::parent} {parent}. -*/ - -/*! - \readonly - \qmlproperty QPointF QtQuick::HandlerPoint::scenePosition - \brief The position within the scene - - This is the position of the event point relative to the bounds of the Qt - Quick scene (typically the whole window). -*/ - -/*! - \readonly - \qmlproperty QPointF QtQuick::HandlerPoint::pressPosition - \brief The pressed position within the \c parent Item - - This is the position at which this point was pressed, relative to the - bounds of the \l {PointerHandler::parent} {parent}. -*/ - -/*! - \readonly - \qmlproperty QPointF QtQuick::HandlerPoint::scenePressPosition - \brief The pressed position within the scene - - This is the position at which this point was pressed, in the coordinate - system of the \l {Qt Quick Scene Graph}{scene graph}. -*/ - -/*! - \readonly - \qmlproperty QPointF QtQuick::HandlerPoint::sceneGrabPosition - \brief The grabbed position within the scene - - If this point has been grabbed by a Pointer Handler or an Item, it means - that object has taken sole responsibility for handling the movement and the - release if this point. In that case, this is the position at which the grab - occurred, in the coordinate system of the \l {Qt Quick Scene Graph}{scene graph}. -*/ - -/*! - \readonly - \qmlproperty enum QtQuick::HandlerPoint::pressedButtons - \brief Which mouse or stylus buttons are currently pressed - - \sa MouseArea::pressedButtons -*/ - -/*! - \readonly - \qmlproperty QVector2D QtQuick::HandlerPoint::velocity - \brief A vector representing the average speed and direction of movement - - This is a velocity vector pointing in the direction of movement, in logical - pixels per second. It has x and y components, at least one of which will be - nonzero when this point is in motion. It holds the average recent velocity: - how fast and in which direction the event point has been moving recently. - - \sa QtQuick::EventPoint::velocity, QtQuick::TouchPoint::velocity, QTouchEvent::TouchPoint::velocity -*/ - -/*! - \readonly - \qmlproperty qreal QtQuick::HandlerPoint::rotation - - This property holds the rotation angle of the stylus on a graphics tablet - or the contact patch of a touchpoint on a touchscreen. - - It is valid only with certain tablet stylus devices and touchscreens that - can measure the rotation angle. Otherwise, it will be zero. -*/ - -/*! - \readonly - \qmlproperty qreal QtQuick::HandlerPoint::pressure - - This property tells how hard the user is pressing the stylus on a graphics - tablet or the finger against a touchscreen, in the range from \c 0 (no - measurable pressure) to \c 1.0 (maximum pressure which the device can - measure). - - It is valid only with certain tablets and touchscreens that can measure - pressure. Otherwise, it will be zero. -*/ - -/*! - \readonly - \qmlproperty size QtQuick::HandlerPoint::ellipseDiameters - - This property holds the diameters of the contact patch, if the event - comes from a touchpoint and the device provides this information. - - A touchpoint is modeled as an elliptical area where the finger is pressed - against the touchscreen. (In fact, it could also be modeled as a bitmap; - but in that case we expect an elliptical bounding estimate to be fitted to - the contact patch before the event is sent.) The harder the user presses, - the larger the contact patch; so, these diameters provide an alternate way - of detecting pressure, in case the device does not include a separate - pressure sensor. The ellipse is centered on \l scenePosition (\l position - in the PointerHandler's Item's local coordinates). The \l rotation property - provides the rotation of the ellipse, if known. It is expected that if the - \l rotation is zero, the \l {QSize::height}{height} is the larger dimension - (the major axis), because of the usual hand position, reaching upward or - outward across the surface. - - If the contact patch is unknown, or the device is not a touchscreen, - these values will be zero. - - \sa QtQuick::EventTouchPoint::ellipseDiameters, QtQuick::TouchPoint::ellipseDiameters, QTouchEvent::TouchPoint::ellipseDiameters -*/ - QT_END_NAMESPACE diff --git a/src/quick/handlers/qquicksinglepointhandler_p.h b/src/quick/handlers/qquicksinglepointhandler_p.h index 7606b4f7ba..e4b0584a08 100644 --- a/src/quick/handlers/qquicksinglepointhandler_p.h +++ b/src/quick/handlers/qquicksinglepointhandler_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2018 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtQuick module of the Qt Toolkit. @@ -51,60 +51,11 @@ // We mean it. // +#include "qquickhandlerpoint_p.h" #include "qquickpointerdevicehandler_p.h" QT_BEGIN_NAMESPACE -class QQuickSinglePointHandler; - -class Q_QUICK_PRIVATE_EXPORT QQuickHandlerPoint { - Q_GADGET - Q_PROPERTY(int id READ id) - Q_PROPERTY(QPointingDeviceUniqueId uniqueId READ uniqueId) - Q_PROPERTY(QPointF position READ position) - Q_PROPERTY(QPointF scenePosition READ scenePosition) - Q_PROPERTY(QPointF pressPosition READ pressPosition) - Q_PROPERTY(QPointF scenePressPosition READ scenePressPosition) - Q_PROPERTY(QPointF sceneGrabPosition READ sceneGrabPosition) - Q_PROPERTY(Qt::MouseButtons pressedButtons READ pressedButtons) - Q_PROPERTY(QVector2D velocity READ velocity) - Q_PROPERTY(qreal rotation READ rotation) - Q_PROPERTY(qreal pressure READ pressure) - Q_PROPERTY(QSizeF ellipseDiameters READ ellipseDiameters) - -public: - QQuickHandlerPoint(); - - int id() const { return m_id; } - Qt::MouseButtons pressedButtons() const { return m_pressedButtons; } - QPointF pressPosition() const { return m_pressPosition; } - QPointF scenePressPosition() const { return m_scenePressPosition; } - QPointF sceneGrabPosition() const { return m_sceneGrabPosition; } - QPointF position() const { return m_position; } - QPointF scenePosition() const { return m_scenePosition; } - QVector2D velocity() const { return m_velocity; } - qreal rotation() const { return m_rotation; } - qreal pressure() const { return m_pressure; } - QSizeF ellipseDiameters() const { return m_ellipseDiameters; } - QPointingDeviceUniqueId uniqueId() const { return m_uniqueId; } - -private: - void reset(); - int m_id; - QPointingDeviceUniqueId m_uniqueId; - Qt::MouseButtons m_pressedButtons; - QPointF m_position; - QPointF m_scenePosition; - QPointF m_pressPosition; - QPointF m_scenePressPosition; - QPointF m_sceneGrabPosition; - QVector2D m_velocity; - qreal m_rotation; - qreal m_pressure; - QSizeF m_ellipseDiameters; - friend class QQuickSinglePointHandler; -}; - class Q_QUICK_PRIVATE_EXPORT QQuickSinglePointHandler : public QQuickPointerDeviceHandler { Q_OBJECT @@ -148,7 +99,6 @@ private: QT_END_NAMESPACE -QML_DECLARE_TYPE(QQuickHandlerPoint) QML_DECLARE_TYPE(QQuickSinglePointHandler) #endif // QQUICKPOINTERSINGLEHANDLER_H |