What does 'bottomRight' mean when using dataChanged() with a QTreeView in Qt?

前端 未结 2 1021
夕颜
夕颜 2021-01-18 01:59

It\'s straight forward to understand the topLeft and bottomRight QModelIndex when using dataChanged(const QModelIndex & topLeft, const QModelIndex & bottomRigh

相关标签:
2条回答
  • 2021-01-18 02:14

    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());
    
    0 讨论(0)
  • 2021-01-18 02:23

    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.

    0 讨论(0)
提交回复
热议问题