How to emit dataChanged to a single role of QAbstractListModel?
-
Hi guys,
I have a massive performance problem with a ListView.
I'm using a subClass of QAbstractListModel as a model for some Data.
In my listView I have a delegate with 14 bindings where 3 values are always visible, and the rest is hidden in a detail-area which you can expend (visible = false when not expended).There is only one of these 14 values which can actually change all the time, but unfortunately I can only fire a dataChanged-signal for the complete model-element.
The performance is terrible! The Analyze-Tool shows me that all elements gets updated, even the hidden ones.How can I solve this problem? I have the feeling that QAbstractListModel is not suitable for this purpose but on the other hand it's the recommended way of propagating model-data.
CU
mtsP.S. Qt 5.5
-
Hi,
Without seeing your code, it's pretty difficult to say if it's a limitation of QAbstractListModel or if there's something not optimal with your setup.
Can you show how you implemented your model ?
-
@themts said:
but unfortunately I can only fire a dataChanged-signal for the complete model-element.
If I understand correctly, it sounds like you want to be using the third parameter (roles) of the dataChanged signal. It defaults to an empty vector which "means that all roles should be considered modified".
-
@themts said:
he performance is terr
I already use the third parameter of dataChanged.
I'm using a modified version of Thomas Boutroue's QQmlObjectListModel.
emit dataChanged(index, index, rolesList);
where roleList has only one item (with the modified role), when I check the Analyze-Tool, I can see that every Binding gets called.
Screenshot QAbstractListModel
Screenshot QList