rename QPointerUniqueId -> QPointingDeviceUniqueId

Several people agreed that the name was confusing and that this one
is better.

Task-number: QTBUG-54616
Change-Id: I31cf057f4bc818332b0551a27d1711599440207c
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Sune Vuorela <sune@vuorela.dk>
This commit is contained in:
Shawn Rutledge 2016-12-01 12:47:55 +01:00 committed by Jani Heikkinen
parent 14ea8759da
commit 7df0c7a309
5 changed files with 34 additions and 34 deletions

View File

@ -4475,14 +4475,14 @@ int QTouchEvent::TouchPoint::id() const
\since 5.8
Returns the unique ID of this touch point or token, if any.
It is normally invalid (see \l {QPointerUniqueId::isValid()} {isValid()}),
It is normally invalid (see \l {QPointingDeviceUniqueId::isValid()} {isValid()}),
because touchscreens cannot uniquely identify fingers. But when the
\l {TouchPoint::InfoFlag} {Token} flag is set, it is expected to uniquely
identify a specific token (fiducial object).
\sa flags
*/
QPointerUniqueId QTouchEvent::TouchPoint::uniqueId() const
QPointingDeviceUniqueId QTouchEvent::TouchPoint::uniqueId() const
{
return d->uniqueId;
}
@ -4758,7 +4758,7 @@ void QTouchEvent::TouchPoint::setUniqueId(qint64 uid)
{
if (d->ref.load() != 1)
d = d->detach();
d->uniqueId = QPointerUniqueId::fromNumericId(uid);
d->uniqueId = QPointingDeviceUniqueId::fromNumericId(uid);
}
/*! \internal */
@ -5177,15 +5177,15 @@ Qt::ApplicationState QApplicationStateChangeEvent::applicationState() const
}
/*!
\class QPointerUniqueId
\class QPointingDeviceUniqueId
\since 5.8
\ingroup events
\inmodule QtGui
\brief QPointerUniqueId identifies a unique object, such as a tagged token
\brief QPointingDeviceUniqueId identifies a unique object, such as a tagged token
or stylus, which is used with a pointing device.
QPointerUniqueIds can be compared for equality, and can be used as keys in a QHash.
QPointingDeviceUniqueIds can be compared for equality, and can be used as keys in a QHash.
You get access to the numerical ID via numericId(), if the device supports such IDs.
For future extensions, though, you should not use that function, but compare objects
of this type using the equality operator.
@ -5201,29 +5201,29 @@ Qt::ApplicationState QApplicationStateChangeEvent::applicationState() const
*/
/*!
\fn QPointerUniqueId::QPointerUniqueId()
\fn QPointingDeviceUniqueId::QPointingDeviceUniqueId()
Constructs an invalid unique pointer ID.
*/
/*!
Constructs a unique pointer ID from numeric ID \a id.
*/
QPointerUniqueId QPointerUniqueId::fromNumericId(qint64 id)
QPointingDeviceUniqueId QPointingDeviceUniqueId::fromNumericId(qint64 id)
{
QPointerUniqueId result;
QPointingDeviceUniqueId result;
result.m_numericId = id;
return result;
}
/*!
\fn bool QPointerUniqueId::isValid()
\fn bool QPointingDeviceUniqueId::isValid()
Returns whether this unique pointer ID is valid, that is, it represents an actual
pointer.
*/
/*!
\property QPointerUniqueId::numericId
\property QPointingDeviceUniqueId::numericId
\brief the numeric unique ID of the token represented by a touchpoint
If the device provides a numeric ID, isValid() returns true, and this
@ -5235,26 +5235,26 @@ QPointerUniqueId QPointerUniqueId::fromNumericId(qint64 id)
\sa isValid()
*/
qint64 QPointerUniqueId::numericId() const Q_DECL_NOTHROW
qint64 QPointingDeviceUniqueId::numericId() const Q_DECL_NOTHROW
{
return m_numericId;
}
/*!
\relates QPointerUniqueId
\relates QPointingDeviceUniqueId
\since 5.8
Returns whether the two unique pointer IDs \a lhs and \a rhs identify the same pointer
(\c true) or not (\c false).
*/
bool operator==(QPointerUniqueId lhs, QPointerUniqueId rhs) Q_DECL_NOTHROW
bool operator==(QPointingDeviceUniqueId lhs, QPointingDeviceUniqueId rhs) Q_DECL_NOTHROW
{
return lhs.numericId() == rhs.numericId();
}
/*!
\fn bool operator!=(QPointerUniqueId lhs, QPointerUniqueId rhs)
\relates QPointerUniqueId
\fn bool operator!=(QPointingDeviceUniqueId lhs, QPointingDeviceUniqueId rhs)
\relates QPointingDeviceUniqueId
\since 5.8
Returns whether the two unique pointer IDs \a lhs and \a rhs identify different pointers
@ -5262,12 +5262,12 @@ bool operator==(QPointerUniqueId lhs, QPointerUniqueId rhs) Q_DECL_NOTHROW
*/
/*!
\relates QPointerUniqueId
\relates QPointingDeviceUniqueId
\since 5.8
Returns the hash value for \a key, using \a seed to seed the calculation.
*/
uint qHash(QPointerUniqueId key, uint seed) Q_DECL_NOTHROW
uint qHash(QPointingDeviceUniqueId key, uint seed) Q_DECL_NOTHROW
{
return qHash(key.numericId(), seed);
}

View File

@ -793,7 +793,7 @@ 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 Q_GUI_EXPORT QPointerUniqueId
class Q_GUI_EXPORT QPointingDeviceUniqueId
{
Q_GADGET
// ### kept these to keep other modules compiling. Remove before 5.8.0 final!
@ -803,11 +803,11 @@ class Q_GUI_EXPORT QPointerUniqueId
Q_PROPERTY(qint64 numericId READ numericId CONSTANT)
public:
Q_ALWAYS_INLINE
Q_DECL_CONSTEXPR QPointerUniqueId() Q_DECL_NOTHROW : m_numericId(-1) {}
Q_DECL_CONSTEXPR QPointingDeviceUniqueId() Q_DECL_NOTHROW : m_numericId(-1) {}
// compiler-generated copy/move ctor/assignment operators are ok!
// compiler-generated dtor is ok!
static QPointerUniqueId fromNumericId(qint64 id);
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;
@ -815,7 +815,7 @@ public:
// ### kept these to keep other modules compiling. Remove before 5.8.0 final!
#if QT_DEPRECATED_SINCE(5, 8)
Q_ALWAYS_INLINE Q_DECL_DEPRECATED qint64 numeric() const { return numericId(); }
Q_ALWAYS_INLINE Q_DECL_DEPRECATED explicit QPointerUniqueId(qint64 id) : m_numericId(id) {}
Q_ALWAYS_INLINE Q_DECL_DEPRECATED explicit QPointingDeviceUniqueId(qint64 id) : m_numericId(id) {}
#endif
private:
// TODO: for TUIO 2, or any other type of complex token ID, an internal
@ -823,13 +823,13 @@ private:
// In this case, m_numericId will then turn into an index into that array (or hash).
qint64 m_numericId;
};
Q_DECLARE_TYPEINFO(QPointerUniqueId, Q_MOVABLE_TYPE);
template <> class QList<QPointerUniqueId> {}; // to prevent instantiation: use QVector instead
Q_DECLARE_TYPEINFO(QPointingDeviceUniqueId, Q_MOVABLE_TYPE);
template <> class QList<QPointingDeviceUniqueId> {}; // to prevent instantiation: use QVector instead
Q_GUI_EXPORT bool operator==(QPointerUniqueId lhs, QPointerUniqueId rhs) Q_DECL_NOTHROW;
inline bool operator!=(QPointerUniqueId lhs, QPointerUniqueId rhs) Q_DECL_NOTHROW
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(QPointerUniqueId key, uint seed = 0) Q_DECL_NOTHROW;
Q_GUI_EXPORT uint qHash(QPointingDeviceUniqueId key, uint seed = 0) Q_DECL_NOTHROW;
@ -868,7 +868,7 @@ public:
{ qSwap(d, other.d); }
int id() const;
QPointerUniqueId uniqueId() const;
QPointingDeviceUniqueId uniqueId() const;
Qt::TouchPointState state() const;

View File

@ -80,7 +80,7 @@ public:
QAtomicInt ref;
int id;
QPointerUniqueId uniqueId;
QPointingDeviceUniqueId uniqueId;
Qt::TouchPointStates state;
QRectF rect, sceneRect, screenRect;
QPointF normalizedPos,

View File

@ -129,7 +129,7 @@ public:
TouchPoint() : id(0), uniqueId(-1), pressure(0), rotation(0), state(Qt::TouchPointStationary) { }
int id; // for application use
qint64 uniqueId; // for TUIO: object/token ID; otherwise empty
// TODO for TUIO 2.0: add registerPointerUniqueID(QPointerUniqueId)
// TODO for TUIO 2.0: add registerPointerUniqueID(QPointingDeviceUniqueId)
QPointF normalPosition; // touch device coordinates, (0 to 1, 0 to 1)
QRectF area; // the touched area, centered at position in screen coordinates
qreal pressure; // 0 to 1

View File

@ -227,7 +227,7 @@ void tst_QTouchEvent::cleanup()
void tst_QTouchEvent::qPointerUniqueId()
{
QPointerUniqueId id1, id2;
QPointingDeviceUniqueId id1, id2;
QCOMPARE(id1.numericId(), Q_INT64_C(-1));
QVERIFY(!id1.isValid());
@ -235,13 +235,13 @@ void tst_QTouchEvent::qPointerUniqueId()
QVERIFY( id1 == id2);
QVERIFY(!(id1 != id2));
QSet<QPointerUniqueId> set; // compile test
QSet<QPointingDeviceUniqueId> set; // compile test
set.insert(id1);
set.insert(id2);
QCOMPARE(set.size(), 1);
const auto id3 = QPointerUniqueId::fromNumericId(-1);
const auto id3 = QPointingDeviceUniqueId::fromNumericId(-1);
QCOMPARE(id3.numericId(), Q_INT64_C(-1));
QVERIFY(!id3.isValid());
@ -252,7 +252,7 @@ void tst_QTouchEvent::qPointerUniqueId()
QCOMPARE(set.size(), 1);
const auto id4 = QPointerUniqueId::fromNumericId(4);
const auto id4 = QPointingDeviceUniqueId::fromNumericId(4);
QCOMPARE(id4.numericId(), Q_INT64_C(4));
QVERIFY(id4.isValid());