QPointingDeviceUniqueId Class
QPointingDeviceUniqueId 用于标识一个唯一的对象(例如带有标签的令牌或触控笔),该对象与指点设备配合使用。更多内容...
| 头文件: | #include <QPointingDeviceUniqueId> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Gui) target_link_libraries(mytarget PRIVATE Qt6::Gui) |
| qmake: | QT += gui |
- 所有成员的列表,包括继承的成员
- QPointingDeviceUniqueId 属于“事件类”下的成员。
属性
- numericId : const qint64
公共函数
| QPointingDeviceUniqueId() | |
| bool | isValid() const |
| qint64 | numericId() const |
静态公共成员
| QPointingDeviceUniqueId | fromNumericId(qint64 id) |
相关的非成员
| size_t | qHash(QPointingDeviceUniqueId key, size_t seed = 0) |
| bool | operator!=(QPointingDeviceUniqueId lhs, QPointingDeviceUniqueId rhs) |
| bool | operator==(QPointingDeviceUniqueId lhs, QPointingDeviceUniqueId rhs) |
详细说明
QPointingDeviceUniqueIds 支持相等性比较,并可作为QHash 中的键使用。如果设备支持此类ID,可通过numericId()获取数值ID。但为了便于未来扩展,不建议使用该函数,而应使用相等运算符来比较该类型的对象。
该类是对整数 ID 的轻量级封装。在函数中,应按值传递该类作为参数。
另请参阅 QEventPoint 。
属性文档
[read-only] numericId : const qint64
该属性保存由触点所代表的令牌的数字唯一标识符
如果设备提供了数字 ID,则 `isValid()` 返回 true,且该属性返回该数字 ID;否则返回 -1。
您不应在可移植代码中使用该属性的值,而应依靠相等性来识别指针。
访问函数:
| qint64 | numericId() const |
另请参阅 isValid()。
成员函数文档
[constexpr noexcept] QPointingDeviceUniqueId::QPointingDeviceUniqueId()
构建了一个无效的唯一指针 ID。
[static] QPointingDeviceUniqueId QPointingDeviceUniqueId::fromNumericId(qint64 id)
根据数字 IDid 生成一个唯一的指针 ID。
[constexpr noexcept] bool QPointingDeviceUniqueId::isValid() const
返回此唯一指针 ID 是否有效,即它是否代表一个实际的指针。
相关的非成员
[noexcept] size_t qHash(QPointingDeviceUniqueId key, size_t seed = 0)
返回key 的哈希值,并使用seed 作为计算的种子。
[noexcept] bool operator!=(QPointingDeviceUniqueId lhs, QPointingDeviceUniqueId rhs)
返回两个唯一的指针 IDlhs 和rhs 是否分别指向不同的指针(true ),还是指向同一个指针(false )。
[noexcept] bool operator==(QPointingDeviceUniqueId lhs, QPointingDeviceUniqueId rhs)
返回两个唯一的指针 IDlhs 和rhs 是否指向同一个指针(true ),还是不指向同一个指针(false )。
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.