本页内容

QBluetoothHostInfo Class

QBluetoothHostInfo 类封装了本地QBluetooth 设备的详细信息。更多内容...

头文件: #include <QBluetoothHostInfo>
CMake: find_package(Qt6 REQUIRED COMPONENTS Bluetooth)
target_link_libraries(mytarget PRIVATE Qt6::Bluetooth)
qmake: QT += bluetooth

公共函数

QBluetoothHostInfo()
QBluetoothHostInfo(const QBluetoothHostInfo &other)
~QBluetoothHostInfo()
QBluetoothAddress address() const
QString name() const
void setAddress(const QBluetoothAddress &address)
void setName(const QString &name)
QBluetoothHostInfo &operator=(const QBluetoothHostInfo &other)
bool operator!=(const QBluetoothHostInfo &a, const QBluetoothHostInfo &b)
bool operator==(const QBluetoothHostInfo &a, const QBluetoothHostInfo &b)

详细说明

该类保存本地蓝牙设备的名称和地址。

成员函数文档

QBluetoothHostInfo::QBluetoothHostInfo()

构建一个空的 QBluetoothHostInfo 对象。

QBluetoothHostInfo::QBluetoothHostInfo(const QBluetoothHostInfo &other)

创建一个新的 QBluetoothHostInfo,该对象是other 的副本。

[noexcept] QBluetoothHostInfo::~QBluetoothHostInfo()

销毁QBluetoothHostInfo 。

QBluetoothAddress QBluetoothHostInfo::address() const

返回蓝牙地址,格式为QBluetoothAddress 。

另请参阅 setAddress()。

QString QBluetoothHostInfo::name() const

返回主机信息对象的用户可见名称。

另请参阅 setName()。

void QBluetoothHostInfo::setAddress(const QBluetoothAddress &address)

设置此蓝牙主机信息对象的蓝牙address 。

另请参阅 address()。

void QBluetoothHostInfo::setName(const QString &name)

设置主机信息对象的name 属性。

另请参阅 name()。

QBluetoothHostInfo &QBluetoothHostInfo::operator=(const QBluetoothHostInfo &other)

将other 分配给此QBluetoothHostInfo 实例。

相关的非成员

bool operator!=(const QBluetoothHostInfo &a, const QBluetoothHostInfo &b)

如果a 和b 不相同,则返回true ;否则返回false 。

bool operator==(const QBluetoothHostInfo &a, const QBluetoothHostInfo &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.