HighonH
HighonH

Reputation: 169

qml stackview: reload top of the stack

Is there a way to reload the item at the top of the stack after a pop operation. Is it always loaded from memory or can I force the page to initialize again.

Upvotes: 0

Views: 816

Answers (1)

derM
derM

Reputation: 13691

The lower pages are kept alive, and a new page is just layered above it. So if you have all the properties of the page properly bound and all signals are properly in place, you would have no need to reload.
Often it is not intended to have it reloaded as you will lose any internal state, such as user input et. al. if you don't always store that information outside of the page.

In case you only want to pause the bindings and re-enable them later, introduce a

 property bool isActive

and use conditional bindings

 property int myProperty: isActive ? someOtherProperty * 5 : 0

or

 Binding {
     ...
     when: isActive
 }

If you really want to reload the whole page, you can do that with a Loader. Instead of pushing the page directly to the stack, push the Loader that loads the page. Then you can just change its active-property to reload the page.

Upvotes: 0

Related Questions