Reputation: 354
I'm using a QTreeView to display data that is updated every second. Each Item in the View has a setData(QVariant value)-function that emit's a custom dataChanged(int index, QVariant value)-signal. When the items are inserted to the Model, the dataChanged()-Signal of the Item get's connected to a itemDataChanged()-Slot of the Model. This function calls the dataChanged()-Signal of the QAbstractItemModel.
When I now start the application, the QTreeView get's only updated when I move my Cursor over the QTreeView.
I already found someone else having the problem, but without a solution. Below are links, to a video of the effect and the original post from qtcentre.org.
https://www.youtube.com/watch?v=1rVhB60VqBQ&feature=youtu.be
Upvotes: 4
Views: 798
Reputation: 1
I'm using a QSortFilterProxyModel but it should work with your tree model. Just emit the dataChanged() signal with invalid model indicies like so:
dataChanged(QModelIndex(), QModelIndex());
This way no data is affected and the treeView refreshes.
Upvotes: 0