Details
-
Suggestion
-
Resolution: Unresolved
-
P2: Important
-
None
Description
Code
import QtQuick Window { width: 800 height: 600 visible: true QtObject { id: myObj signal mySignal() onMySignal: console.log("Ding!") onMySignall: console.log("Dong!") // WARNING: no matching signal found for handler "onMySignall" [unqualified] } Connections { target: myObj function onMySignal() { console.log("Ding!") } function onMySignall() { // No edit-/build-time warning console.log("Dong!") } } Component.onCompleted: myObj.mySignal() }
Outcomes
(Expected) qmlls, qmllint, and qmlsc all warn about the mis-spelt declarative signal handler:
no matching signal found for handler "onMySignall" [unqualified] onMySignall: console.log("Dong!") ^^^^^^^^^^^
(Not Expected) No such warnings are provided for the mis-spelt Connections function during edit-/build-time. We only get a runtime warning:
QML Connections: Detected function "onMySignall" in Connections element. This is probably intended to be a signal handler but no signal of the target matches the name.
Suggestions
- QML tools should apply the same heuristics as the runtime engine. If a Connection's target's list of signals is known, and a function in that Connections has a name that starts with "on", but no matching signal in the target, then flag it.
- Bonus: Also flag if the parameter lists are incompatible