diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-01-28 15:00:47 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-01-29 15:49:19 +0100 |
commit | 767947bd8633d301ca3183b49f8096e30c30d180 (patch) | |
tree | bb80d626c3f5f1f35a6acd41c3a2271b2a231bbb | |
parent | 96cf13fe8e89f89247ed10c86521072da5d9ca40 (diff) |
QBluetoothDeviceDiscoveryAgent/Windows: Fix deprecation warnings
Change the code merging the Uuid sets to use QVector, fixing:
qbluetoothdevicediscoveryagent_win.cpp:546:58: warning: 'QSet<T> QList<T>::toSet() const [with T = QBluetoothUuid]' is deprecated: Use
qbluetoothdevicediscoveryagent_win.cpp:548:54: warning: 'QList<T> QSet<T>::toList() const [with T = QBluetoothUuid]' is deprecated: Use values() instead. [-Wdeprecated-declarations]
Change-Id: I0e0780ef0b120318fe356cd58113a746adeff8a5
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
-rw-r--r-- | src/bluetooth/qbluetoothdevicediscoveryagent_win.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_win.cpp b/src/bluetooth/qbluetoothdevicediscoveryagent_win.cpp index 159428d4..eec76173 100644 --- a/src/bluetooth/qbluetoothdevicediscoveryagent_win.cpp +++ b/src/bluetooth/qbluetoothdevicediscoveryagent_win.cpp @@ -51,6 +51,8 @@ #include <setupapi.h> #include <bluetoothapis.h> +#include <algorithm> + QT_BEGIN_NAMESPACE Q_DECLARE_LOGGING_CATEGORY(QT_BT_WINDOWS) @@ -541,11 +543,12 @@ void QBluetoothDeviceDiscoveryAgentPrivate::processDiscoveredDevice( } else { qCDebug(QT_BT_WINDOWS) << "Updating device:" << deviceIt->name() << deviceIt->address(); // merge service uuids - QList<QBluetoothUuid> uuids = deviceIt->serviceUuids(); - uuids.append(foundDevice.serviceUuids()); - const QSet<QBluetoothUuid> uuidSet = uuids.toSet(); - if (deviceIt->serviceUuids().count() != uuidSet.count()) - deviceIt->setServiceUuids(uuidSet.toList().toVector()); + auto uuids = deviceIt->serviceUuids().toVector(); + uuids.append(foundDevice.serviceUuids().toVector()); + std::sort(uuids.begin(), uuids.end()); + uuids.erase(std::unique(uuids.begin(), uuids.end()), uuids.end()); + if (deviceIt->serviceUuids().count() != uuids.count()) + deviceIt->setServiceUuids(uuids); if (deviceIt->coreConfigurations() != foundDevice.coreConfigurations()) deviceIt->setCoreConfigurations( QBluetoothDeviceInfo::BaseRateAndLowEnergyCoreConfiguration); |