[SOLVED]Qml, connect to SIGNAL from component created in parent scope
-
Hello,
In my main.qml file I create and instance of an object defined in the c++ backend. Further the main.qml file contains a stackview on which views are pushed and popped (from user input or signals from the c++ object). Each view is in its own qml file.
In the main.qml and the qml files for the different views I can bind to Q_PROPERTY's from the c++ object.
In the definition of the c++ object in the main.qml I can also connect to Signals from the c++ object.
But what I can't do is to connect to signlas from the c++ object in on of the child views.
Some code the clarify
main.qml
@ApplicationWindow {
id: applicationWindow1
visible: true
width: 800
height: 600BackendObject { id: myObject onSignalA{stackView.push(Qt.resolvedUrl("ViewA")} //works onSignalB{.....} //works .... } StackView { initialItem: stackView.push(Qt.resolvedUrl("InitialView") ...... } @
The ViewA.qml
@
Item
{
Text:
{
text:myObject.TextProperty //databind to text property (works)
}myObject.onSignalB{... }//this does not work, the entire view is'nt displayed but there is no output in the console
}
@Anybody an idea as on how to solve this?
(I could create a property and change the property instead of emitting the signal, but that seems like a lot of overhead code).