You should emit dataChanged whenever the data of existing items change and layoutChanged whenever you add or remove items (or reorder them).
You should emit dataChanged whenever the data of existing items change and layoutChanged whenever you add or remove items (or reorder them).
Bah, I've been trying for a while now, and I can't figure out how to get the index() and parent() functions to work. Basically all I'm doing is reading a qstring returned from a qdailog and adding it to a qstringlist. How do I connect this to the QAbstractItemModel?
IMO your index() should look like so:
Qt Code:
return createIndex(row, column); }To copy to clipboard, switch view to plain text mode
For parent and a "flat" (tabular) model you can always return QModelIndex() as all items have an invalid parent.
Bookmarks