How to inform listview that model data has changed?
-
-
Hi,
You can use "dataChanged":http://qt-project.org/doc/qt-4.8/qabstractitemmodel.html#dataChanged with both first and last item pointing to the same index.
Hope it helps
-
I am not sure I am following you correctly:
You do have a custom model right ?
The where does your changes come from ? -
If your model is custom, the listener should notify your model that something has changed, then you should update the model content and emit the signal
-
Let me explain using some pseudo code:
@
class ModelItem {
ModelItem(file) {
registerChangeHandler(file, this, &ModelItem::fileChanged)
}void fileChanged(file) {
// How do I update the model, this ModelItem is part of?
}
}class Model : public QAbstractItemModel {
}
@
In fileChanged() how do I update my model, which will then in turn update the UI? -
Are you sure that fileChanged should be in the item and not the model ?