Syntax
This warning category is spelled [syntax]
by qmllint.
Nested inline components are not supported
What happened?
You defined an inline component inside another inline component.
Why is this bad?
The QML language does not allow nested inline components. Always define inline components inside the root item of the QML file.
Example
import QtQuick Item { component Correct: Item { component Evil: Item { ... } ... } }
To fix this warning, move all components to the root item of the QML file.
import QtQuick Item { component NotEvilAnymore: Item { ... } component Correct: Item { ... } }
Inline component declaration must be followed by a typename
What happened?
You defined an inline component with an invalid base type.
Why is this bad?
Inline components need a base type to inherit from.
Example
In this case, someProperty
is not a valid type name, as it is a property name. To fix this warning, use a valid Type as the component's base type:
import QtQuick Item { property Item someProperty component InlineComponent: Item { ... } }
Invalid alias expression: an initializer is needed
What happened?
You defined a property alias without its aliased property.
Why is this bad?
Alias properties always need to have their aliased property or id in their definition.
Example
To fix this warning, replace the alias with a normal property, or add the missing aliased property:
import QtQuick Item { id: root property int someProperty property alias withAliasedProperty: root.someProperty }
Invalid alias expression: only ids and field member expressions can be aliased
What happened?
You defined a property alias that aliases an expression other than an ID or a field member expression.
A field member expression is an expression of the form someId.someProperty
.
Why is this bad?
Alias properties always need to have their aliased property in their definition, and can't bind to other expressions than IDs and field member expressions.
Example
To fix this warning, replace the alias with a normal property or bind it to an id or field member expression:
import QtQuick Item { id: root property int p property int someProperty: p + 1 property alias alternative: root.p }
Id must be followed by an identifier
What happened?
You defined an id without a value.
Why is this bad?
The QML language does not allow empty ids.
Example
import QtQuick Item { id:; }
To fix this warning, bind the id to a valid name:
import QtQuick Item { id: root; }
Failed to parse id
What happened?
You bound an id to an expression other than a name.
Why is this bad?
The QML language only allows names as bindings to ids; more complex expressions can't be used.
Example
import QtQuick Item { property int a property int b function f() { if (true) return a return b } id: f() }
To fix this warning, bind the id to a valid name or declare a property and set up a binding:
import QtQuick Item { property int a property int b function f() { if (true) return a return b } id: someItem // it would be confusing to call it `f` like the function property int alternative: f() }
Declaring an object which is not a QML object as a list member
What happened?
You added an expression other than an object into a list of objects.
Why is this bad?
The QML language only allows objects in object lists.
Example
To fix this warning, use a valid object type, or remove the item from the list:
Enums declared inside of inline components are ignored
What happened?
You defined an enum inside an inline component.
Why is this bad?
The QML language only allows enum definitions inside the root item of the QML file. Enums declared inside an inline component are unusable, even inside the inline component. The same applies to enums declared inside non-root QML objects.
Example
To fix this warning, move the enum declaration into the root element of the QML file:
Unknown argument to pragma
What happened?
You specified an invalid argument to a pragma.
Why is this bad?
The pragma will have no effect.
Example
pragma ComponentBehavior: Buond
import QtQuick
Item {
}
You can fix this warning by removing the pragma or fixing a potential typo:
pragma ComponentBehavior: Bound
import QtQuick
Item {
}
© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.