It\'s straight forward to understand the topLeft and bottomRight QModelIndex when using dataChanged(const QModelIndex & topLeft, const QModelIndex & bottomRigh
The dataChanged()
signal from a model updates the view. The code emit
dataChanged(QModelIndex(), QModelIndex())
will update the whole tree view. The call of tree view's update()
doesn't work.
Code:
// update the whole tree views.
emit dataChanged(QModelIndex(), QModelIndex());
The dataChanged()
signal has the same meaning for both table views and tree views. However if changed items in tree view have different parents, the behavior is undefined.
WRT your question about updating the whole tree view, the answer is no, you cannot update it by emitting this signal. The dataChanged()
signal emitted after the model has been updated.