How to push a text string in a StackView

1681
2
11-22-2018 10:58 AM
GiatriLalla
New Contributor III

Good Day,

I understand that a page in stackview can be pushed by the code below for example:

StackView {

   id: stackView

   anchors.fill: parent    

   initialItem: startPage

}

Component {

   id: startPage

   StartPage {

   onNext: {

      stackView.push (page2);

} etc.

How can a text string be pushed in stackview from one page to another? Thank you.

0 Kudos
2 Replies
StephenQuan1
Esri Contributor

Not entirely sure I understand your question. Can you provide more information? What is this string? A stackview can only have pages pushed to it. Is this text string a parameter on the page? If you give an explanation to the problem you're trying to solve we can better help you.

JaysonWard
New Contributor III

Hi Giatri:

I think what you want to do is assign a text string property on one view with a text string property from another view. You pass parameters in the push method after the id of the view being pushed onto the stack.

 stackView.push (page2, { "propertyNameSetOnPage2": "the string you want to pass to page 2"});

In that example on Page 2 you would have:

property string propertyNameSetOnPage2

and when the view is pushed onto the stack, that property will get set to "the string you want to pass to page 2"

See: StackView QML Type | Qt Quick Controls 2 5.11