Incompatible type
This warning category is spelled c{[incompatible-type]} by qmllint.
Cannot assign to default property of incompatible type
What happened?
You assigned an object to a default property of an incompatible type.
Why is this bad?
The QML engine will not be able to assign the object at runtime.
Example
import QtQuick Item { component MyType: QtObject { default property list<Item> myDefaultProperty } MyType { QtObject {} // note: QtObject does not inherit from Item } }
To fix this warning, bind a compatible type to the property or, if you are the author of the default property, change the type in the definition:
import QtQuick Item { component MyType: QtObject { default property list<Item> myDefaultProperty } MyType { Item {} } component AlternativeMyType: QtObject { default property list<QtObject> myDefaultProperty } AlternativeMyType { QtObject {} // is ok for AlternativeMyType } }
On-binding for property has wrong type
What happened?
You used an invalid property modifier type.
Why is this bad?
The QML engine will not be able to use the property modifier type at runtime.
Example
import QtQuick Item { property int xxx Item on xxx { ... } }
To fix this warning, remove the on
or use a valid property modifier type:
import QtQuick Item { property int xxx Item { ... } // Alternative: use a valid property modifier type NumberAnimation on xxx { ... } }
Function without return type annotation returns
What happened?
You returned a value from a function without return type annotation.
Why is this bad?
You annotated the function to not return anything so the function should not return anything. The QML tooling will not be able to process the method and the QML engine will ignore the returned value in a future Qt version.
Example
import QtQuick Item { function f(x: int) { ... return x } }
To fix this warning, adapt the function signature to the new return type or remove the return value:
import QtQuick Item { function f(x: int): int { ... return x } function alternativeF(x: int) { ... return } }
Cannot assign binding/object/literal
What happened?
You bound an object, literal, or expression to a property of an incompatible type.
Why is this bad?
The QML engine will not be able to assign the object, literal, or expression at runtime.
Example
To fix this warning, bind an object, value, or expression of a compatible type:
© 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.