Solved QML pop return value
-
I'm using stackview to open a barcode reading page through a form.
How do I after reading, go back to the previous page and put the reading result in a field on the page?
-
- define signal in your page you want to push
- when you are done trigger the signal and call Stackview.view.pop() (note the attached property)
- when/before pushing connect to that signal and do whatever you want with it
-
@raven-worx can you give an example?
-
// MyComponent.qml Item { signal mySignal(var value) // somewhere in your code: function finish() { mySignal(someValue) Stackview.view.pop() } }
Item { Component { id: myComp MyComponent { onMySignal: { // do something with "value" // you can also call pop() on the stackview here (instead of in MyComponent) } } function pushPage() { myStackView.push( myComp ) } }
-
@raven-worx thank you