Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to emit dataChanged to a single role of QAbstractListModel?
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.
P.S. Qt 5.5
I just made a trial and used a QList<QObject*> as a model. -> no Problems at all.
I think its a major problem of QAbstractListModel that you cannot emit which data has to be updated!
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 ?
Paul Colby last edited by
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".
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.