Reputation: 18950
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"
Upvotes: 1
Views: 430
Reputation: 4208
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
Upvotes: 3
Reputation: 18950
Silly workaround (but it works...)
readonly property bool _dragActive: drag.active
on_DragActiveChanged: {
... = drag.active
}
Upvotes: 0