diff options
Diffstat (limited to 'tools/qmllint')
-rw-r--r-- | tools/qmllint/findwarnings.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/qmllint/findwarnings.cpp b/tools/qmllint/findwarnings.cpp index 3d59259ea3..9fe3bf99bd 100644 --- a/tools/qmllint/findwarnings.cpp +++ b/tools/qmllint/findwarnings.cpp @@ -267,8 +267,14 @@ bool FindWarningVisitor::visit(QQmlJS::AST::UiScriptBinding *uisb) auto expstat = cast<ExpressionStatement *>(uisb->statement); auto identexp = cast<IdentifierExpression *>(expstat->expression); m_qmlid2scope.insert(identexp->name.toString(), m_currentScope); - if (m_currentScope->isVisualRootScope()) - m_rootId = identexp->name.toString(); + + // Figure out whether the current scope is the root scope. + if (auto parentScope = m_currentScope->parentScope()) { + if (auto grandParentScope = parentScope->parentScope()) { + if (!grandParentScope->parentScope()) + m_rootId = identexp->name.toString(); + } + } } else { const QString signal = signalName(name); if (signal.isEmpty()) |