I'm creating QML application (QT 5.2)
Assume I have some object set as root context:
viewer.rootContext()->setContextObject(&view_model);
Now I want to bind to a signal of view_model
from QML:
Connections {
target: ??? WHAT SHOULD GO HERE ???
onSignalStateChanged: console.log("signal")
}
Cannot figure out what should be the target.
Important: I don't want to use setContextProperty
.
It seems you can't use Connections
if you don't have access to object instance (via context property for example). But you still could use following:
function onSignal() {
console.log( "signal" );
}
Component.onCompleted: {
onSignalStateChanged.connect( onSignal );
}
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments