QML: how to save memory on invisible elements?
-
I have a QML Image type and a QML Video type overlaying each other (same sizes).
At one time, only either of those two elements is visible and needed.What's the best way to save memory?
Should i set the visible property to false?
Or focus or enabled?Thanks for help,
Ben -
@ben80 I doubt making them invisible will hardly reduce memory because the item is still loaded in the memory with all its binding and other stuff.
IMO what you can do is lazy load the item as said by @Sandman usingLoader
and if you want to save memory then the only way is to delete and create them everytime but it may affect time. So basically you have to do performance vs time profiling. -
U need to dynamically create object either using loader as already suggested or qt.createcomponent and createobject
-
-
So, that means none of the properties will lead to less memory consumption, right?
visible, focus, enabled, ...AFAIK. Yes.