QStandardModel::setData() doesn't update in QTreeView until tree is hidden, then shown again.
-
I have a QStandardModel which I display in a QTreeView
If I change the value in a QStandardItem which is in the QStandardModel using QStandardModel::setData(index, value), the tree doesn't show the updated value until I either click in the cell that is being updated, or click some other cell at random, or I put in the code:
tree->setVisible(false);
tree->setVisible(true);This doesn't seem right. Why doesn't setData immediately get updated in the QTreeView as soon as it is updated in the QStandardItem in the QStandardModel that the tree is showing?
-
From QAbstractItemModel documentation:
"The dataChanged() signal should be emitted if the data was successfully set.
The base class implementation returns false. This function and data() must be reimplemented for editable models."Please check if dataChanged() signal is emitted. If not, you have to emit this signal