summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/bluetooth/btchat/chatserver.cpp2
-rw-r--r--examples/bluetooth/lowenergyscanner/characteristicinfo.cpp3
-rw-r--r--examples/bluetooth/lowenergyscanner/device.cpp4
-rw-r--r--examples/nfc/annotatedurl/annotatedurl.cpp2
-rw-r--r--examples/nfc/ndefeditor/mainwindow.cpp2
5 files changed, 7 insertions, 6 deletions
diff --git a/examples/bluetooth/btchat/chatserver.cpp b/examples/bluetooth/btchat/chatserver.cpp
index e4293c75..5d59cd77 100644
--- a/examples/bluetooth/btchat/chatserver.cpp
+++ b/examples/bluetooth/btchat/chatserver.cpp
@@ -154,7 +154,7 @@ void ChatServer::sendMessage(const QString &message)
{
QByteArray text = message.toUtf8() + '\n';
- foreach (QBluetoothSocket *socket, clientSockets)
+ for (QBluetoothSocket *socket : qAsConst(clientSockets))
socket->write(text);
}
//! [sendMessage]
diff --git a/examples/bluetooth/lowenergyscanner/characteristicinfo.cpp b/examples/bluetooth/lowenergyscanner/characteristicinfo.cpp
index 58f91f5d..f64ddf79 100644
--- a/examples/bluetooth/lowenergyscanner/characteristicinfo.cpp
+++ b/examples/bluetooth/lowenergyscanner/characteristicinfo.cpp
@@ -76,7 +76,8 @@ QString CharacteristicInfo::getName() const
return name;
// find descriptor with CharacteristicUserDescription
- foreach (const QLowEnergyDescriptor &descriptor, m_characteristic.descriptors()) {
+ const QList<QLowEnergyDescriptor> descriptors = m_characteristic.descriptors();
+ for (const QLowEnergyDescriptor &descriptor : descriptors) {
if (descriptor.type() == QBluetoothUuid::CharacteristicUserDescription) {
name = descriptor.value();
break;
diff --git a/examples/bluetooth/lowenergyscanner/device.cpp b/examples/bluetooth/lowenergyscanner/device.cpp
index 2ae30c16..cfbf4596 100644
--- a/examples/bluetooth/lowenergyscanner/device.cpp
+++ b/examples/bluetooth/lowenergyscanner/device.cpp
@@ -256,7 +256,7 @@ void Device::connectToService(const QString &uuid)
//discovery already done
const QList<QLowEnergyCharacteristic> chars = service->characteristics();
- foreach (const QLowEnergyCharacteristic &ch, chars) {
+ for (const QLowEnergyCharacteristic &ch : chars) {
CharacteristicInfo *cInfo = new CharacteristicInfo(ch);
m_characteristics.append(cInfo);
}
@@ -326,7 +326,7 @@ void Device::serviceDetailsDiscovered(QLowEnergyService::ServiceState newState)
//! [les-chars]
const QList<QLowEnergyCharacteristic> chars = service->characteristics();
- foreach (const QLowEnergyCharacteristic &ch, chars) {
+ for (const QLowEnergyCharacteristic &ch : chars) {
CharacteristicInfo *cInfo = new CharacteristicInfo(ch);
m_characteristics.append(cInfo);
}
diff --git a/examples/nfc/annotatedurl/annotatedurl.cpp b/examples/nfc/annotatedurl/annotatedurl.cpp
index 0e6b58fa..acd401f2 100644
--- a/examples/nfc/annotatedurl/annotatedurl.cpp
+++ b/examples/nfc/annotatedurl/annotatedurl.cpp
@@ -143,7 +143,7 @@ void AnnotatedUrl::handleMessage(const QNdefMessage &message, QNearFieldTarget *
QPixmap pixmap;
//! [handleMessage 2]
- foreach (const QNdefRecord &record, message) {
+ for (const QNdefRecord &record : message) {
if (record.isRecordType<QNdefNfcTextRecord>()) {
QNdefNfcTextRecord textRecord(record);
diff --git a/examples/nfc/ndefeditor/mainwindow.cpp b/examples/nfc/ndefeditor/mainwindow.cpp
index 38865b88..869f1790 100644
--- a/examples/nfc/ndefeditor/mainwindow.cpp
+++ b/examples/nfc/ndefeditor/mainwindow.cpp
@@ -266,7 +266,7 @@ void MainWindow::ndefMessageRead(const QNdefMessage &message)
{
clearMessage();
- foreach (const QNdefRecord &record, message) {
+ for (const QNdefRecord &record : message) {
if (record.isRecordType<QNdefNfcTextRecord>()) {
addRecord<TextRecordEditor>(ui, record);
} else if (record.isRecordType<QNdefNfcUriRecord>()) {