diff options
author | Liang Qi <liang.qi@qt.io> | 2016-12-16 09:38:46 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-12-16 09:45:16 +0100 |
commit | 9bfe3ab71e5291445e66be96d6cd1f63934a2d83 (patch) | |
tree | a3b5580d8788de658f39d5bdb23d84a447999bee /src/gui/kernel/qevent.h | |
parent | 28dffdecdad4f3458b9aacec1a04803c7b5483a1 (diff) | |
parent | 179045f36a16ce2f6cfaad1dbd9443b52b1bf8d3 (diff) |
Merge remote-tracking branch 'origin/5.8.0' into 5.8
Conflicts:
doc/global/qt-cpp-defines.qdocconf
src/plugins/platforms/android/qandroidplatformopenglcontext.h
src/plugins/platforms/android/qandroidplatformtheme.h
Change-Id: I13d51cc66f708138ff4d667ceea7d515992e58a4
Diffstat (limited to 'src/gui/kernel/qevent.h')
-rw-r--r-- | src/gui/kernel/qevent.h | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index a062331bd8..7881df205a 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -793,21 +793,36 @@ inline bool operator==(QKeyEvent *e, QKeySequence::StandardKey key){return (e ? inline bool operator==(QKeySequence::StandardKey key, QKeyEvent *e){return (e ? e->matches(key) : false);} #endif // QT_NO_SHORTCUT -class QPointerUniqueIdPrivate; -class Q_GUI_EXPORT QPointerUniqueId +class Q_GUI_EXPORT QPointingDeviceUniqueId { Q_GADGET - Q_PROPERTY(qint64 numeric READ numeric CONSTANT) + Q_PROPERTY(qint64 numericId READ numericId CONSTANT) public: - explicit QPointerUniqueId(qint64 id = -1); + Q_ALWAYS_INLINE + Q_DECL_CONSTEXPR QPointingDeviceUniqueId() Q_DECL_NOTHROW : m_numericId(-1) {} + // compiler-generated copy/move ctor/assignment operators are ok! + // compiler-generated dtor is ok! - qint64 numeric() const; + static QPointingDeviceUniqueId fromNumericId(qint64 id); + + Q_ALWAYS_INLINE Q_DECL_CONSTEXPR bool isValid() const Q_DECL_NOTHROW { return m_numericId != -1; } + qint64 numericId() const Q_DECL_NOTHROW; private: - // TODO for TUIO 2, or any other type of complex token ID, a d-pointer can replace - // m_numericId without changing the size of this class. + // TODO: for TUIO 2, or any other type of complex token ID, an internal + // array (or hash) can be added to hold additional properties. + // In this case, m_numericId will then turn into an index into that array (or hash). qint64 m_numericId; }; +Q_DECLARE_TYPEINFO(QPointingDeviceUniqueId, Q_MOVABLE_TYPE); +template <> class QList<QPointingDeviceUniqueId> {}; // to prevent instantiation: use QVector instead + +Q_GUI_EXPORT bool operator==(QPointingDeviceUniqueId lhs, QPointingDeviceUniqueId rhs) Q_DECL_NOTHROW; +inline bool operator!=(QPointingDeviceUniqueId lhs, QPointingDeviceUniqueId rhs) Q_DECL_NOTHROW +{ return !operator==(lhs, rhs); } +Q_GUI_EXPORT uint qHash(QPointingDeviceUniqueId key, uint seed = 0) Q_DECL_NOTHROW; + + class QTouchEventTouchPointPrivate; class Q_GUI_EXPORT QTouchEvent : public QInputEvent @@ -844,7 +859,7 @@ public: { qSwap(d, other.d); } int id() const; - QPointerUniqueId uniqueId() const; + QPointingDeviceUniqueId uniqueId() const; Qt::TouchPointState state() const; |