Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.0.0
-
None
-
6080375fed90c09bfabb96a0319817f14f693b05
Description
Connections element doesn't work with objects that are exposed through the new module API. Connections element is handy when you need to listen to a signal of an object that is either exposed as a context property or that hasn't been declared inside the QML document listening to the signal. There might be a good reason why this doesn't work, but nevertheless it goes against developer's expectations.
Code below
import QtQuick 2.0 import module 1.0 as Module Connections { target: Module onPropertyNameChanged: console.log("propertyName", propertyName) }
just produces warning
file:///../file.qml:4: Unable to assign null to QObject*
There exists a simple workaround for listening to property change signals, but this doesn't work with plain signals:
property variant propertyName: Module.propertyName
onPropertyNameChanged: console.log("propertyName", propertyName)