Unqualified
This warning category is spelled [unqualified]
by qmllint.
Unqualified access
What happened?
You accessed a parent element without its id.
Why is this bad?
This makes the code harder to read and impedes performance.
Example
import QtQuick Item { property int helloWorld Item { property int unqualifiedAccess: helloWorld + 1 // not ok: Unqualified access here. } }
To fix this warning, refer to the parent object by id. You will need to add an id first if the object currently has none.
import QtQuick Item { id: root property int helloWorld Item { property int unqualifiedAccess: root.helloWorld + 1 // ok: this access is qualified now! } }
Unknown attached/grouped property scope
What happened?
You used an attached property type or grouped property that can't be found. This can be caused by a typo or by a missing QML module dependency.
Note: If you are importing QML modules with external dependencies, verify that they are actually installed and inside an import path.
Why is this bad?
Components with unknown attached property scopes or unknown grouped properties will not be created at runtime: they will be null instead.
Example
Let's try to use the (inexistent) attached property of Item
or the (inexistent) grouped property grouped
of Item
:
import QtQuick Item { Item.helloAttached: 44 // not ok: unknown attached property scope Item. [unqualified] grouped.helloGrouped: 44 // not ok: unknown grouped property scope grouped. [unqualified] }
Indeed, Item does neither have any attached type nor any grouped property called item
. To fix this warning, remove the attached type and the grouped property.
Refer to Attached Properties and Attached Signal Handlers on how to use attached properties and to Grouped Properties on how to use grouped properties.
No matching signal found for handler
What happened?
You used a signal handler on a signal that can't be found. This can be caused by a typo in the signal handler or by a missing QML module dependency.
Note: The name of a signal handler is on
concatenated with the capitalized signal name. onHelloWorld
handles the signal helloWorld
and on_helloWorld
handles _helloWorld
, for example.
Note: If you are importing QML modules with external dependencies, verify that they are actually installed and inside an import path.
Why is this bad?
Components with unknown signal handlers will not be created at runtime: they will be null instead.
Example
Lets try to write a signal handler for the (inexistent) signal mySignal
:
import QtQuick Item { onMySignal: console.log("hello") // not ok: no matching signal found for handler "onMySignal" [unqualified] }
Indeed, this Item does not have any signal called mySignal
. To fix this warning, remove the signal handler or add the missing signal.
Implicitly defining signal handler in Connections is deprecated
What happened?
You used a signal handler on a Connections type.
Why is this bad?
This is deprecated.
Example
import QtQuick Window { id: root property int myInt Connections { target: root onMyIntChanged: console.log("new int", myInt) } }
To fix this warning, replace the signal handler binding with a function:
import QtQuick Window { id: root property int myInt Connections { target: root function onMyIntChanged() { console.log("new int", myInt) } } }