[Interest] How to refresh QML View when QAbstractListModel contents are modified?

Harri Pasanen harri at mpaja.com
Fri Jun 8 14:14:24 CEST 2012


On 06/07/2012 05:07 PM, Harri Pasanen wrote:
> I have a QML PathView hooked up to a C++ model.  My problem is that 
> when I update a list item in C++, the QML PathView hooked up to it is 
> not updated.
>
> My update function is:
>
> void FrameList::rename(int i, const QString &newname)
> {
>     _itemList[i].setName(newname);
>     QModelIndex r1 = index(i);
>     QModelIndex r2 = index(i);
>     emit dataChanged(r1,r2);
> }
>
> Kind of basic question, but as it looks to me that dataChanged() is 
> not picked up by QML side here, I wonder how I should go about it?
>

Never mind, dataChanged() seems to work fine.
It is just easier to notice when you actually change the data... :).

Sorry for the noise,

Harri



More information about the Interest mailing list