Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
4.7.1
-
None
Description
If a signal emits a QObject* and the signal is connected to a function using connect(), the QObject* parameter is received as a QVariant rather than an object.
Given this code:
Rectangle { id: rect width: 200; height: 50 function myFunction(mouse) { console.log("In function:", mouse, mouse.x) } MouseArea { id: area anchors.fill: parent onClicked: { console.log("In handler:", mouse, mouse.x) } } Component.onCompleted: { area.clicked.connect(myFunction) } }
When the MouseArea is clicked, the output is:
In handler: QDeclarativeMouseEvent(0x7fff5fbfdb10) 108 In function: QVariant(QDeclarativeMouseEvent*) undefined
Since the 'mouse' object is received as a variant by myFunction(), none of the MouseEvent properties can be read.