Syntax

[syntax] Various syntactic errors.

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

To fix this warning, move all components to the root item of the QML file.

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:

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:

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:

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

To fix this warning, bind the id to a valid name:

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

To fix this warning, bind the id to a valid name or declare a property and set up a binding:

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

You can fix this warning by removing the pragma or fixing a potential typo: