Changes to Qt Bluetooth¶
Migrate QtBluetooth to Qt 6.
Qt 6 is a result of the conscious effort to make the framework more efficient and easy to use.
We try to maintain binary and source compatibility for all the public APIs in each release. But some changes were inevitable in an effort to make Qt a better framework.
In this topic we summarize those changes in QtBluetooth , and provide guidance to handle them.
qbluetoothglobal.h was removed. qtbluetoothglobal.h is the official header with the same purpose.
Every usage of
QVectorhas been replaced by
Win32 backend has been removed. There will not be a working Bluetooth backend when Qt is built with mingw.
Since there is now only one Windows backend, the logging category qt.bluetooth.winrt was removed. The corresponding log messages are now in qt.bluetooth.windows.
AttAccessConstraint have been changed to a scoped enums for improved type safety.
QBluetoothDeviceDiscoveryAgent::inquiryType property and related setter/getter & enum were removed. The API element was never implemented and/or supported.
manufacturerData() returns a
QHash. Since Qt 6
QMultiHashis no longer derived from
DataCompleteness was removed without replacement as the related API elements no longer served a purpose
QBluetoothUuid>, DataCompleteness) was replaced by setServiceUuids(const
DataCompleteness serviceUuidsCompleteness() const was removed without replacement.
QBluetoothUuid> serviceUuids(DataCompleteness *completeness = nullptr) const was replaced by
QBluetoothUuid> serviceUuids() const.
The pairing agent related API was removed without replacement. This includes pairingConfirmation(bool), pairingDisplayPinCode(..) & pairingDisplayConfirmation(..). Except for Android and BlueZ 4 there was never an implementation for it. Bluez 4 support was removed in Qt 6 and Android’s implementation required unobtainable BLUETOOTH_PRIVILEGED for at least parts of the code.
Renamed ServiceState enum values:
This change happens in anticipation that service discovery might become an optional step in the future.
CharacteristicType , and
DescriptorType are now scoped enums. The usage of enum items has to be adapted in user code.
Existing ctors and create*() functions with remote
QBluetoothAddressparameters have been removed.
QBluetoothAddressis not sufficient to indicate remote devices on Apple systems. It requires UUIDs to “name” devices. This can only be satisfied by
QLowEnergyControllerctors have been made private. The createPeripheral() and createCentral() functions should be used to obtain
The new method clientCharacteristicConfiguration() has been introduced to conveniently obtain the Client Characteristic Configuration Descriptor.
The handle() method is no longer part of the public Bluetooth LE interfaces. It’s purpose as identifier for characteristics was replaced. The
QLowEnergyCharacteristicinstances itself serve as identifier.
The handle() method is no longer part of the public Bluetooth LE interfaces. It’s purpose as identifier for descriptors was replaced. The
QLowEnergyDescriptor instances itself serve as identifier.
QBluetoothTransferManager, QBluetoothTransferRequest, and QBluetoothTransferReply have been removed without replacement.
SocketError are now scoped enums. The usage of enum items has to be adapted in user code.
The QML interface has been removed because socket programming via QML is not advisable. QDeclarativeBluetoothService, QDeclarativeBluetoothSocket, and QDeclarativeBluetoothDiscoveryModel (in QML: BluetoothService, BluetoothSocket, and BluetoothDiscoveryModel) have been removed without replacement.
The “error” signals in
QLowEnergyController , and
QLowEnergyService have been renamed to “errorOccurred” to remove ambiguities between the “error” signal and the “error” getter.
© 2022 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.