diff options
author | hjk <hjk@qt.io> | 2019-07-24 13:43:54 +0200 |
---|---|---|
committer | hjk <hjk@qt.io> | 2019-07-29 08:54:18 +0000 |
commit | e3b1106afae5de6cd54ce627a0b11be041624591 (patch) | |
tree | accfac6791013e79476650b6dd840d5cf243e12b /src/plugins/debugger | |
parent | 02e224fcfa7135f1e32adb02a14426ea153ae618 (diff) | |
download | qt-creator-e3b1106afae5de6cd54ce627a0b11be041624591.tar.gz |
Compile fix with recent Qt dev
The reasoning in 1b4766e26c6b did not take into account that the scope
of QT_NO_JAVA_STYLE_ITERATORS may change over time, as done with
f70905448f6 in Qt base.
Change-Id: Ib1966ff26c4d36d5f62e149d6b45baa4aecf825d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'src/plugins/debugger')
-rw-r--r-- | src/plugins/debugger/gdb/gdbengine.cpp | 4 | ||||
-rw-r--r-- | src/plugins/debugger/qml/qmlengine.cpp | 6 | ||||
-rw-r--r-- | src/plugins/debugger/watchhandler.cpp | 59 | ||||
-rw-r--r-- | src/plugins/debugger/watchhandler.h | 4 |
4 files changed, 24 insertions, 49 deletions
diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 1d0b219172..f17410ac09 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -2048,9 +2048,7 @@ void GdbEngine::setTokenBarrier() { //QTC_ASSERT(m_nonDiscardableCount == 0, /**/); bool good = true; - QHashIterator<int, DebuggerCommand> it(m_commandForToken); - while (it.hasNext()) { - it.next(); + for (auto it = m_commandForToken.cbegin(), end = m_commandForToken.cend(); it != end; ++it) { if (!(m_flagsForToken.value(it.key()) & Discardable)) { qDebug() << "TOKEN: " << it.key() << "CMD:" << it.value().function; good = false; diff --git a/src/plugins/debugger/qml/qmlengine.cpp b/src/plugins/debugger/qml/qmlengine.cpp index 6b3dd37193..3b8ed0a9c5 100644 --- a/src/plugins/debugger/qml/qmlengine.cpp +++ b/src/plugins/debugger/qml/qmlengine.cpp @@ -886,12 +886,10 @@ static ConsoleItem *constructLogItemTree(const QVariant &result, else text = key + " : Object"; - QMap<QString, QVariant> resultMap = result.toMap(); + const QMap<QString, QVariant> resultMap = result.toMap(); QVarLengthArray<ConsoleItem *> children(resultMap.size()); - QMapIterator<QString, QVariant> i(result.toMap()); auto it = children.begin(); - while (i.hasNext()) { - i.next(); + for (auto i = resultMap.cbegin(), end = resultMap.cend(); i != end; ++i) { *(it++) = constructLogItemTree(i.value(), i.key()); } diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp index 432a67176b..d3cfeebec8 100644 --- a/src/plugins/debugger/watchhandler.cpp +++ b/src/plugins/debugger/watchhandler.cpp @@ -220,18 +220,14 @@ static void saveWatchers() static void loadFormats() { - QVariant value = SessionManager::value("DefaultFormats"); - QMapIterator<QString, QVariant> it(value.toMap()); - while (it.hasNext()) { - it.next(); + QMap<QString, QVariant> value = SessionManager::value("DefaultFormats").toMap(); + for (auto it = value.cbegin(), end = value.cend(); it != end; ++it) { if (!it.key().isEmpty()) theTypeFormats.insert(it.key(), it.value().toInt()); } - value = SessionManager::value("IndividualFormats"); - it = QMapIterator<QString, QVariant>(value.toMap()); - while (it.hasNext()) { - it.next(); + value = SessionManager::value("IndividualFormats").toMap(); + for (auto it = value.cbegin(), end = value.cend(); it != end; ++it) { if (!it.key().isEmpty()) theIndividualFormats.insert(it.key(), it.value().toInt()); } @@ -240,9 +236,7 @@ static void loadFormats() static void saveFormats() { QMap<QString, QVariant> formats; - QHashIterator<QString, int> it(theTypeFormats); - while (it.hasNext()) { - it.next(); + for (auto it = theTypeFormats.cbegin(), end = theTypeFormats.cend(); it != end; ++it) { const int format = it.value(); if (format != AutomaticFormat) { const QString key = it.key().trimmed(); @@ -253,9 +247,7 @@ static void saveFormats() SessionManager::setValue("DefaultFormats", formats); formats.clear(); - it = QHashIterator<QString, int>(theIndividualFormats); - while (it.hasNext()) { - it.next(); + for (auto it = theIndividualFormats.cbegin(), end = theIndividualFormats.cend(); it != end; ++it) { const int format = it.value(); const QString key = it.key().trimmed(); if (!key.isEmpty()) @@ -2395,9 +2387,7 @@ QStringList WatchHandler::watchedExpressions() { // Filter out invalid watchers. QStringList watcherNames; - QMapIterator<QString, int> it(theWatcherNames); - while (it.hasNext()) { - it.next(); + for (auto it = theWatcherNames.cbegin(), end = theWatcherNames.cend(); it != end; ++it) { const QString &watcherName = it.key(); if (!watcherName.isEmpty()) watcherNames.push_back(watcherName); @@ -2512,9 +2502,7 @@ QString WatchHandler::typeFormatRequests() const { QString ba; if (!theTypeFormats.isEmpty()) { - QHashIterator<QString, int> it(theTypeFormats); - while (it.hasNext()) { - it.next(); + for (auto it = theTypeFormats.cbegin(), end = theTypeFormats.cend(); it != end; ++it) { const int format = it.value(); if (format != AutomaticFormat) { ba.append(toHex(it.key())); @@ -2532,9 +2520,7 @@ QString WatchHandler::individualFormatRequests() const { QString res; if (!theIndividualFormats.isEmpty()) { - QHashIterator<QString, int> it(theIndividualFormats); - while (it.hasNext()) { - it.next(); + for (auto it = theIndividualFormats.cbegin(), end = theIndividualFormats.cend(); it != end; ++it) { const int format = it.value(); if (format != AutomaticFormat) { res.append(it.key()); @@ -2548,19 +2534,16 @@ QString WatchHandler::individualFormatRequests() const return res; } -void WatchHandler::appendFormatRequests(DebuggerCommand *cmd) +void WatchHandler::appendFormatRequests(DebuggerCommand *cmd) const { QJsonArray expanded; - QSetIterator<QString> jt(m_model->m_expandedINames); - while (jt.hasNext()) - expanded.append(jt.next()); + for (const QString &name : qAsConst(m_model->m_expandedINames)) + expanded.append(name); cmd->arg("expanded", expanded); QJsonObject typeformats; - QHashIterator<QString, int> it(theTypeFormats); - while (it.hasNext()) { - it.next(); + for (auto it = theTypeFormats.cbegin(), end = theTypeFormats.cend(); it != end; ++it) { const int format = it.value(); if (format != AutomaticFormat) typeformats.insert(it.key(), format); @@ -2568,12 +2551,10 @@ void WatchHandler::appendFormatRequests(DebuggerCommand *cmd) cmd->arg("typeformats", typeformats); QJsonObject formats; - QHashIterator<QString, int> it2(theIndividualFormats); - while (it2.hasNext()) { - it2.next(); - const int format = it2.value(); + for (auto it = theIndividualFormats.cbegin(), end = theIndividualFormats.cend(); it != end; ++it) { + const int format = it.value(); if (format != AutomaticFormat) - formats.insert(it2.key(), format); + formats.insert(it.key(), format); } cmd->arg("formats", formats); } @@ -2586,18 +2567,16 @@ static inline QJsonObject watcher(const QString &iname, const QString &exp) return watcher; } -void WatchHandler::appendWatchersAndTooltipRequests(DebuggerCommand *cmd) +void WatchHandler::appendWatchersAndTooltipRequests(DebuggerCommand *cmd) const { QJsonArray watchers; const DebuggerToolTipContexts toolTips = m_engine->toolTipManager()->pendingTooltips(); for (const DebuggerToolTipContext &p : toolTips) watchers.append(watcher(p.iname, p.expression)); - QMapIterator<QString, int> it(WatchHandler::watcherNames()); - while (it.hasNext()) { - it.next(); + for (auto it = theWatcherNames.cbegin(), end = theWatcherNames.cend(); it != end; ++it) watchers.append(watcher("watch." + QString::number(it.value()), it.key())); - } + cmd->arg("watchers", watchers); } diff --git a/src/plugins/debugger/watchhandler.h b/src/plugins/debugger/watchhandler.h index 18228fc346..6d94249eea 100644 --- a/src/plugins/debugger/watchhandler.h +++ b/src/plugins/debugger/watchhandler.h @@ -86,8 +86,8 @@ public: static QStringList watchedExpressions(); static QMap<QString, int> watcherNames(); - void appendFormatRequests(DebuggerCommand *cmd); - void appendWatchersAndTooltipRequests(DebuggerCommand *cmd); + void appendFormatRequests(DebuggerCommand *cmd) const; + void appendWatchersAndTooltipRequests(DebuggerCommand *cmd) const; QString typeFormatRequests() const; QString individualFormatRequests() const; |