[SOLVED]How to control refreshing qml view?
-
It should not happen. Are you doing any heavy processing in it ?
QAbstractListModel::data will be called only when needed from the delegate. And on the first launch by default it should not even load all the items unless requested. -
No heavy processing.
On What basis, delegate requests data from model?
-
Whenever delegates are instantiated.
-
There is an animation control in view item. Delegate updates the animation by using model data in delegate. And, items are getting added and deleted based on animation status. Should I destroy items manually? Any inputs.
-
Does the ListView load all of the Items initially ?
-
It's empty initially. C++ model fetches data from server and inform to AbstractListModel through signals (Add, update, del). Whenever any changes on model, it reflects immediately on view. Any inputs?
-
bq. C++ model fetches data from server
Have you made sure that this operation is not doing any CPU intensive work ?
-
Verified with QML View and without QML View. When I launched ui, then only I can see cpu high. Otherwise, it's very normal. Added logs in AbstractListModel overridden functions. Model emit signal for every change. But, "data" fired many times. So, I suspected on "data" calling from qml.
-
May be somewhere the List is getting refilled again on each added Item. Can you post the code ?
-
Thank you for your inputs. My TCP Server sends 100+ events to client in a second. Controlled the signals passing to view. Now, cpu normal. Thank you again.
-
Ok. You're Welcome :)
Please mark the post as solved.