Qt Creator suggests that the onDragChanged
slot exists in MouseArea
.
MouseArea {
id: mouseArea
...
onDragChanged: console.log('Drag changed')
}
But at runtime it fails with:
Cannot assign to non-existent property "onDragChanged"
CodePudding user response:
Silly workaround (but it works...)
readonly property bool _dragActive: drag.active
on_DragActiveChanged: {
... = drag.active
}
CodePudding user response:
The proper way would be:
drag.onActiveChanged: console.log("Drag active:", drag.active)
This is because drag
is a group of properties (under the hood it's a QObject or alike), so you need to reference that group first.
Your initial attempt doesn't work because drag
is declared as CONSTANT Q_PROPERTY, which doesn't have a on...Changed
signal