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

Harri Pasanen harri at mpaja.com
Thu Jun 7 17:07:04 CEST 2012


Hi,

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?

Thanks,

Harri



More information about the Interest mailing list