This warning category is spelled [use-proper-function] by qmllint.
You used a property of the type var as if it were a callable function.
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.
import QtQuick Item { property var fun: () => console.log("Hello") Component.onCompleted: { fun(); } }
To fix this warning, declare fun as a function to be able to call it:
import QtQuick Item { function fun() { console.log("Hello") } Component.onCompleted: { fun(); } }
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++.
The property was very probably not meant to be called and will make the QML engine error out at runtime.
import QtQuick Rectangle { // Rectangle has a property gradient of the type QJSValue Component.onCompleted: { console.log(gradient()); } }
To fix this warning, remove the call to gradient:
import QtQuick Item { // Rectangle has a property gradient of the type QJSValue Component.onCompleted: { console.log(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.
You called a signal that is shadowed by a property or you shadowed a signal with a property.
The caller very probably expected to call a signal, and not the shadowing property. This could make the QML engine error out at runtime.
import QtQuick Item { component Base: Item { signal helloSignal } Base { property int helloSignal // shadows helloSignal inherited from Base Component.onCompleted: { helloSignal(); } } }
To fix this warning, rename the shadowing property:
import QtQuick Item { component Base: Item { signal helloSignal } Base { property int helloSignal2 // does not shadow anymore Component.onCompleted: { helloSignal(); } } }
See {Signal is shadowed by a property}.
See {Signal is shadowed by a property}.
You used a property of a type other than var or QJSValue as if it were a callable function.
The property can't be called and will make the QML engine error out at runtime.
import QtQuick Item { property int hello Component.onCompleted: { console.log(hello()); } }
To fix this warning, remove the call or make hello a function:
import QtQuick
Item {
property int hello
Component.onCompleted: { console.log(hello); }
// alternative:
function helloAlternative() { ... }
Component.onCompleted: { console.log(helloAlternative()); }
}
As part of the free Business evaluation, we offer a free welcome call for companies, to talk about your requirements, and how the Felgo SDK & Services can help you. Just sign up and schedule your call.
Sign up now to start your free Business evaluation: