Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
unresolved-alias.qdoc
Go to the documentation of this file.
1
// Copyright (C) 2023 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4
/*!
5
\ingroup qmllint-warnings-and-errors
6
7
\title Unresolved alias
8
\brief [unresolved-alias] Property of property alias was not found.
9
10
\qmllintwarningcategory unresolved-alias
11
12
\section1 Unresolved alias
13
14
\section2 What happened?
15
A property alias should hold a reference to another property, see also
16
\l{QML Object Attributes#property-aliases}{QML Object Attributes - Property Aliases}.
17
In this case, it holds a reference to a property that was not found.
18
19
\section2 Why is this bad?
20
Instances of components with unresolved alias will not be created at runtime:
21
they will be null instead.
22
23
\section2 Example
24
\qml
25
import QtQuick
26
27
Item {
28
id: someId
29
property int helloWorld
30
31
property alias helloWorldAlias: helloWorld // not ok: aliases have to refer by id
32
property alias helloWorldAlias2: someId.helloWorlddd // not ok: no helloWorlddd in someId
33
property alias helloWorldAlias3: someIddd.helloWorld // not ok: someIddd does not exist
34
}
35
36
\endqml
37
To fix this warning, make sure that the id and the property of the alias property
38
really do exist:
39
\qml
40
import QtQuick
41
42
Item {
43
id: someId
44
property int helloWorld
45
46
property alias helloWorldAlias: someId.helloWorld // ok: alias refers by id
47
property alias helloWorldAlias2: someId.helloWorld // ok: helloWorld does exist in someId
48
property alias helloWorldAlias3: someId.helloWorld // ok: someId does exist
49
}
50
\endqml
51
*/
qtdeclarative
src
qml
doc
src
qmllint
unresolved-alias.qdoc
Generated on
for Qt by
1.16.1