Unresolved alias

This warning category is spelled [unresolved-alias] by qmllint.

Unresolved alias

What happened?

A property alias should hold a reference to another property, see also QML Object Attributes - Property Aliases . In this case, it holds a reference to a property that was not found.

Why is this bad?

Instances of components with unresolved alias will not be created at runtime: they will be null instead.

范例

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
}
					

To fix this warning, make sure that the id and the property of the alias property really do exist:

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
}