diff options
author | Anton Kudryavtsev <a.kudryavtsev@netris.ru> | 2016-08-12 14:19:33 +0300 |
---|---|---|
committer | Anton Kudryavtsev <a.kudryavtsev@netris.ru> | 2016-08-26 12:40:37 +0000 |
commit | 31a2cbbbc2dcf7d87a4b90c90c193e09e9676d6c (patch) | |
tree | b122e5ac93f6577ad7d39ec89faae2f2bb9562e8 /src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp | |
parent | 0445f31a6fae37aa4f6b92978ff58b0f2848d36b (diff) |
Plugins: replace 'foreach' with 'range for'
Mark some local variables as const to prevent detach()'ing.
Use qAsConst where is not possible mark as const.
If a container is changed in a loop's body, just make copy
like 'foreach'.
Change-Id: Ic453a688a9edf8a864d47f6e3a605164508a027c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp')
-rw-r--r-- | src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp b/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp index 3145601612..9eeb285951 100644 --- a/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp +++ b/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp @@ -205,7 +205,7 @@ QQmlNativeDebugConnector::QQmlNativeDebugConnector() QQmlNativeDebugConnector::~QQmlNativeDebugConnector() { - foreach (QQmlDebugService *service, m_services) { + for (QQmlDebugService *service : qAsConst(m_services)) { service->stateAboutToBeChanged(QQmlDebugService::NotConnected); service->setState(QQmlDebugService::NotConnected); service->stateChanged(QQmlDebugService::NotConnected); @@ -232,12 +232,12 @@ void QQmlNativeDebugConnector::addEngine(QJSEngine *engine) Q_ASSERT(!m_engines.contains(engine)); TRACE_PROTOCOL("Add engine to connector:" << engine); - foreach (QQmlDebugService *service, m_services) + for (QQmlDebugService *service : qAsConst(m_services)) service->engineAboutToBeAdded(engine); announceObjectAvailability(QLatin1String("qmlengine"), engine, true); - foreach (QQmlDebugService *service, m_services) + for (QQmlDebugService *service : qAsConst(m_services)) service->engineAdded(engine); m_engines.append(engine); @@ -248,12 +248,12 @@ void QQmlNativeDebugConnector::removeEngine(QJSEngine *engine) Q_ASSERT(m_engines.contains(engine)); TRACE_PROTOCOL("Remove engine from connector:" << engine); - foreach (QQmlDebugService *service, m_services) + for (QQmlDebugService *service : qAsConst(m_services)) service->engineAboutToBeRemoved(engine); announceObjectAvailability(QLatin1String("qmlengine"), engine, false); - foreach (QQmlDebugService *service, m_services) + for (QQmlDebugService *service : qAsConst(m_services)) service->engineRemoved(engine); m_engines.removeOne(engine); |