[Interest] Stack view and lazy loading of big Qml files
bruno.coudoin at gcompris.net
Fri Jan 2 23:26:12 CET 2015
Le 30/12/2014 10:10, Nuno Santos a écrit :
> I have a stack view which will be used to load the main content of application views.
> Currently, when I select a new view, I pass the url of the correspondent Qml file. I use the replace method because in fact i’m only interested in the transition animation.
> The problem is that in arm devices like android and ipad, the transition is not immediate due to the fact that the Qml being loaded are quite heavy.
> The app users won’t understand that so I wanted to load all the views without showing them and instead of passing the url I would pass the id of the component.
> My questions are:
> What is the best way of doing that?
> Where should I keep the elements without having them rendered on the screen?
> Is there any other way of making this?
In order to have the StackView display the next page during the
transition, it needs to be rendered asap.
Now if the page is too heavy and that incurs a lag I can suggest you to
defer the creation of the heavy part after the transition is completed.
To do this, look at the StackViewDelegate getTransition() or
transitionFinished() method where you can access the entering item with
properties.enterItem and then send it a signal to the loaded item to
load the heavy part.
More information about the Interest