QmlDesigner: Show error/warning for root reference

Show an error when an alias property references the root item directly.
Show a warning when an alias property references the root item in a
hierarchy.

Task-number: QDS-4380
Change-Id: I312fc0296e3bb2321a4d9e1113bd0cd4c1c0b8ed
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Henning Gruendl
2022-01-19 10:34:12 +01:00
committed by Henning Gründl
parent ba08864954
commit 73ae5bb1f6
3 changed files with 45 additions and 1 deletions

View File

@@ -255,6 +255,10 @@ StaticAnalysisMessages::StaticAnalysisMessages()
tr("Components are only allowed to have a single child element."));
newMsg(WarnComponentRequiresChildren, Warning,
tr("Components require a child element."));
newMsg(ErrAliasReferRoot, Error,
tr("Do not reference the root item as alias."));
newMsg(WarnAliasReferRootHierarchy, Warning,
tr("Avoid referencing the root item in a hierarchy."));
}
} // anonymous namespace