Details
-
Suggestion
-
Resolution: Unresolved
-
P3: Somewhat important
-
4.7.2
-
None
Description
I'm often having QML items that are connected with a C++ backend. Those items listen to signals emitted by the backend and react accordingly. E.g. by changing the data displayed or by playing an animation. Often those items are not visible to the user. But, while invisible, they still react to all signals fired by the backend.
This is bad for performance and battery consumption.
There is also the special case that the application is in the background or screen lock is enabled. In this case most signal handlers and animations should be stopped to prevent power drain.
To solve this, I propose a property 'active' or 'enabled' on Item. Setting this property to false would disconnect all signal handlers of this and all child items.
MyScreen { active: isCurrentScreen SomeItem { text: backend.actitvePoi.name // Does not update if active == false image: backend.activePoi.image // Does not update if active == false } }