diff options
Diffstat (limited to 'tests/auto/qlowenergycharacteristic/tst_qlowenergycharacteristic.cpp')
-rw-r--r-- | tests/auto/qlowenergycharacteristic/tst_qlowenergycharacteristic.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/auto/qlowenergycharacteristic/tst_qlowenergycharacteristic.cpp b/tests/auto/qlowenergycharacteristic/tst_qlowenergycharacteristic.cpp index e0513cea..1862af7f 100644 --- a/tests/auto/qlowenergycharacteristic/tst_qlowenergycharacteristic.cpp +++ b/tests/auto/qlowenergycharacteristic/tst_qlowenergycharacteristic.cpp @@ -114,7 +114,7 @@ void tst_QLowEnergyCharacteristic::initTestCase() // find first service with descriptor QLowEnergyController *controller = 0; - foreach (const QBluetoothDeviceInfo &remoteDevice, remoteLeDevices) { + for (const QBluetoothDeviceInfo &remoteDevice : qAsConst(remoteLeDevices)) { controller = new QLowEnergyController(remoteDevice, this); qDebug() << "Connecting to" << remoteDevice.name() << remoteDevice.address() << remoteDevice.deviceUuid(); @@ -138,7 +138,8 @@ void tst_QLowEnergyCharacteristic::initTestCase() QCOMPARE(stateSpy.at(1).at(0).value<QLowEnergyController::ControllerState>(), QLowEnergyController::DiscoveredState); - foreach (const QBluetoothUuid &leServiceUuid, controller->services()) { + const QList<QBluetoothUuid> leServiceUuids = controller->services(); + for (const QBluetoothUuid &leServiceUuid : leServiceUuids) { QLowEnergyService *leService = controller->createServiceObject(leServiceUuid, this); if (!leService) continue; @@ -147,8 +148,8 @@ void tst_QLowEnergyCharacteristic::initTestCase() QTRY_VERIFY_WITH_TIMEOUT( leService->state() == QLowEnergyService::ServiceDiscovered, 10000); - QList<QLowEnergyCharacteristic> chars = leService->characteristics(); - foreach (const QLowEnergyCharacteristic &ch, chars) { + const QList<QLowEnergyCharacteristic> chars = leService->characteristics(); + for (const QLowEnergyCharacteristic &ch : chars) { if (!ch.descriptors().isEmpty()) { globalService = leService; globalControl = controller; |