diff options
author | Sami Shalayel <sami.shalayel@qt.io> | 2023-10-10 10:57:09 +0200 |
---|---|---|
committer | Sami Shalayel <sami.shalayel@qt.io> | 2023-10-13 09:01:02 +0200 |
commit | 82777745402c032bdac1ba3daa31b85eed1fb2fb (patch) | |
tree | 66f6e4b9cfbb9ca89a0f8a94a99ba6068bf4f1b8 /src/qml/doc | |
parent | bb946f67547c48ee5387f989d891dc35251022b1 (diff) |
doc: add unresolved alias in qmllint warnings
Add description of the warning and an example on how to fix it.
Task-number: QTBUG-111137
Change-Id: If0c309124b74184f0fdec995fa7eeb68b104cb30
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/doc')
-rw-r--r-- | src/qml/doc/src/qmllint/unresolved-alias.qdoc | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/src/qml/doc/src/qmllint/unresolved-alias.qdoc b/src/qml/doc/src/qmllint/unresolved-alias.qdoc index 38518c3089..63b02613dd 100644 --- a/src/qml/doc/src/qmllint/unresolved-alias.qdoc +++ b/src/qml/doc/src/qmllint/unresolved-alias.qdoc @@ -5,22 +5,46 @@ \page qmllint-warnings-and-errors-unresolved-alias.html \ingroup qmllint-warnings-and-errors -\title unresolved-alias -\brief BRIEF +\title Unresolved Alias +\brief Property of property alias was not found. -\section1 unresolved-alias +\section1 Unresolved Alias \section2 What happened? -TODO +A property alias should hold a reference to another property, see also +\l{QML Object Attributes#property-aliases}{QML Object Attributes - Property Aliases}. +In this case, it holds a reference to a property that was not found. \section2 Why is this bad? -TODO +Instances of components with unresolved alias will not be created at runtime: +they will be null instead. \section2 Example \qml +import QtQuick + +Item { + id: someId + property int helloWorld + + property alias helloWorldAlias: helloWorld // not ok: aliases have to refer by id + property alias helloWorldAlias2: someId.helloWorlddd // not ok: no helloWorlddd in someId + property alias helloWorldAlias3: someIddd.helloWorld // not ok: someIddd does not exist +} + \endqml -You can fix this warning by TODO +You can fix this warning by making sure that the id and the properties of the alias property +really do exist: \qml +import QtQuick + +Item { + id: someId + property int helloWorld + + property alias helloWorldAlias: someId.helloWorld // ok: alias refers by id + property alias helloWorldAlias2: someId.helloWorld // ok: helloWorld does exist in someId + property alias helloWorldAlias3: someId.helloWorld // ok: someId does exist +} \endqml */ - |