Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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\page qmllint-warnings-and-errors-unresolved-alias.html
6\ingroup qmllint-warnings-and-errors
7
8\title Unresolved Alias
9\brief Property of property alias was not found.
10
11\section1 Unresolved Alias
12
13\section2 What happened?
14A property alias should hold a reference to another property, see also
15\l{QML Object Attributes#property-aliases}{QML Object Attributes - Property Aliases}.
16In this case, it holds a reference to a property that was not found.
17
18\section2 Why is this bad?
19Instances of components with unresolved alias will not be created at runtime:
20they will be null instead.
21
22\section2 Example
23\qml
24import QtQuick
25
26Item {
27 id: someId
28 property int helloWorld
29
30 property alias helloWorldAlias: helloWorld // not ok: aliases have to refer by id
31 property alias helloWorldAlias2: someId.helloWorlddd // not ok: no helloWorlddd in someId
32 property alias helloWorldAlias3: someIddd.helloWorld // not ok: someIddd does not exist
33}
34
35\endqml
36You can fix this warning by making sure that the id and the properties of the alias property
37really do exist:
38\qml
39import QtQuick
40
41Item {
42 id: someId
43 property int helloWorld
44
45 property alias helloWorldAlias: someId.helloWorld // ok: alias refers by id
46 property alias helloWorldAlias2: someId.helloWorld // ok: helloWorld does exist in someId
47 property alias helloWorldAlias3: someId.helloWorld // ok: someId does exist
48}
49\endqml
50*/