QBluetoothAddress Class
QBluetoothAddress 类为蓝牙设备分配一个地址。更多内容...
| 头文件: | #include <QBluetoothAddress> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Bluetooth) target_link_libraries(mytarget PRIVATE Qt6::Bluetooth) |
| qmake: | QT += bluetooth |
公共函数
| QBluetoothAddress() | |
| QBluetoothAddress(const QString &address) | |
| QBluetoothAddress(quint64 address) | |
| QBluetoothAddress(QBluetoothAddress &&) | |
| void | clear() |
| bool | isNull() const |
| QString | toString() const |
| quint64 | toUInt64() const |
| QBluetoothAddress & | operator=(QBluetoothAddress &&) |
相关的非成员
(since 6.6) size_t | qHash(const QBluetoothAddress &key, size_t seed = 0) |
| bool | operator!=(const QBluetoothAddress &a, const QBluetoothAddress &b) |
| bool | operator<(const QBluetoothAddress &a, const QBluetoothAddress &b) |
| bool | operator==(const QBluetoothAddress &a, const QBluetoothAddress &b) |
成员函数文档
[constexpr noexcept] QBluetoothAddress::QBluetoothAddress()
构建一个空的蓝牙地址。
[explicit] QBluetoothAddress::QBluetoothAddress(const QString &address)
构建一个新的蓝牙地址,并将其赋值为address 。
address 的格式可以是 XX:XX:XX:XX:XX:XX 或 XXXXXXXXXXXX,其中 X 代表十六进制数字。不区分大小写。
[explicit constexpr noexcept] QBluetoothAddress::QBluetoothAddress(quint64 address)
创建一个新的蓝牙地址,并将其值设置为address 。
[constexpr noexcept default] QBluetoothAddress::QBluetoothAddress(QBluetoothAddress &&)
通过Move构造一个QBluetoothAddress 的实例。
[noexcept] void QBluetoothAddress::clear()
将蓝牙地址设置为 00:00:00:00:00:00。
[noexcept] bool QBluetoothAddress::isNull() const
如果蓝牙地址为空,则返回 true;否则返回 false。
QString QBluetoothAddress::toString() const
返回蓝牙地址,格式为 XX:XX:XX:XX:XX:XX。
[noexcept] quint64 QBluetoothAddress::toUInt64() const
将此蓝牙地址作为 quint64 类型返回。
[noexcept default] QBluetoothAddress &QBluetoothAddress::operator=(QBluetoothAddress &&)
将other 分配给此QBluetoothAddress 实例。
相关的非成员
[noexcept, since 6.6] size_t qHash(const QBluetoothAddress &key, size_t seed = 0)
返回key 的哈希值,并使用seed 作为计算的种子。
该函数于 Qt 6.6 中引入。
bool operator!=(const QBluetoothAddress &a, const QBluetoothAddress &b)
如果两个蓝牙地址a 和b 不相等,则返回true ;否则返回false 。
bool operator<(const QBluetoothAddress &a, const QBluetoothAddress &b)
如果蓝牙地址a 小于b ,则返回 true;否则返回 false。
bool operator==(const QBluetoothAddress &a, const QBluetoothAddress &b)
如果两个蓝牙地址a 和b 相等,则返回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.