From c4c8094e32ad78dee558a80584470172f48c45b1 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Mon, 1 Apr 2019 22:15:19 +0200 Subject: get rid of some foreach and Q_FOREACH constructs See https://www.kdab.com/goodbye-q_foreach/ This is reduced to the places where the container is const or can be made const without the need to always introduce an extra variable. Sadly qAsConst (Qt 5.7) and std::as_const (C++17) are not available in all supported setups. Also do some minor cleanups along the way. Signed-off-by: Rolf Eike Beer --- mobile-widgets/qmlmanager.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'mobile-widgets') diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index 1e2b6e132..196554654 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -599,7 +599,7 @@ void QMLManager::handleSslErrors(const QList &errors) { auto *reply = qobject_cast(sender()); setStartPageText(RED_FONT + tr("Cannot open cloud storage: Error creating https connection") + END_FONT); - Q_FOREACH (QSslError e, errors) { + for (QSslError e: errors) { appendTextToLog(e.errorString()); } reply->abort(); @@ -1761,8 +1761,8 @@ void QMLManager::setStatusbarColor(QColor) void QMLManager::retrieveBluetoothName() { QString name = DC_devName(); - QList btDCs = BTDiscovery::instance()->getBtDcs(); - foreach (BTDiscovery::btVendorProduct btDC, btDCs) { + const QList btDCs = BTDiscovery::instance()->getBtDcs(); + for (BTDiscovery::btVendorProduct btDC: btDCs) { qDebug() << "compare" <