Use proper function¶
[use-proper-function] Calling something that might not be a function.
This warning category is spelled [use-proper-function] by qmllint.
Property is a variant property: It may or may not be a method¶
What happened?¶
You used a property of the type var as if it were a callable function.
Why is this bad?¶
This affects the readability of the code, the QML engine will error out if the property does not contain a callable function, and the QML tooling can’t apply specific method optimizations.
Example¶
To fix this warning, declare fun as a function to be able to call it:
Property is a QJSValue property: It may or may not be a method¶
What happened?¶
You used a property of the type QJSValue as if it were a callable function.
Note
Properties of the type QJSValue can only be defined in C++.
Why is this bad?¶
The property was very probably not meant to be called and will make the QML engine error out at runtime.
Example¶
To fix this warning, remove the call to gradient:
Alternatively, consider replacing the property definition with a regular Q_INVOKABLE method or a slot if you are the author of the property. This is only possible if the function is never meant to be changed in QML. If you actually need to store a callback, you’re out of luck.
Signal is shadowed by a property¶
What happened?¶
You called a signal that is shadowed by a property or you shadowed a signal with a property.
Why is this bad?¶
The caller very probably expected to call a signal, and not the shadowing property. This could make the QML engine error out at runtime.
Example¶
To fix this warning, rename the shadowing property:
Method is shadowed by a property¶
See {Signal is shadowed by a property}.
Slot is shadowed by a property¶
See {Signal is shadowed by a property}.
Property is not a method¶
What happened?¶
You used a property of a type other than var or QJSValue as if it were a callable function.
Why is this bad?¶
The property can’t be called and will make the QML engine error out at runtime.
Example¶
To fix this warning, remove the call or make hello a function: