QmlJsEditor: Remove foreach / Q_FOREACH usage

Task-number: QTCREATORBUG-27464
Change-Id: I77741a639d8585d1e0ad04d7c5e6588852202e4a
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Artem Sokolovskii
2022-05-17 16:11:03 +02:00
parent 840263eb9a
commit 54d4c4db62
11 changed files with 69 additions and 58 deletions

View File

@@ -268,15 +268,17 @@ void QmlJSHoverHandler::identifyMatch(TextEditorWidget *editorWidget, int pos, R
bool QmlJSHoverHandler::matchDiagnosticMessage(QmlJSEditorWidget *qmlEditor, int pos)
{
foreach (const QTextEdit::ExtraSelection &sel,
qmlEditor->extraSelections(TextEditorWidget::CodeWarningsSelection)) {
const QList<QTextEdit::ExtraSelection> selections =
qmlEditor->extraSelections(TextEditorWidget::CodeWarningsSelection);
for (const QTextEdit::ExtraSelection &sel : selections) {
if (pos >= sel.cursor.selectionStart() && pos <= sel.cursor.selectionEnd()) {
setToolTip(sel.format.toolTip());
return true;
}
}
foreach (const QTextLayout::FormatRange &range,
qmlEditor->qmlJsEditorDocument()->diagnosticRanges()) {
const QVector<QTextLayout::FormatRange> ranges =
qmlEditor->qmlJsEditorDocument()->diagnosticRanges();
for (const QTextLayout::FormatRange &range : ranges) {
if (pos >= range.start && pos < range.start+range.length) {
setToolTip(range.format.toolTip());
return true;
@@ -357,7 +359,8 @@ void QmlJSHoverHandler::handleImport(const ScopeChain &scopeChain, AST::UiImport
if (!imports)
return;
foreach (const Import &import, imports->all()) {
const QList<Import> importList = imports->all();
for (const Import &import : importList) {
if (import.info.ast() == node) {
if (import.info.type() == ImportType::Library
&& !import.libraryPath.isEmpty()) {