Should I emit QAbstractItemModel dataChanged for parent node only in a tree model

Viewed 101

I am writing a QAbstractItemModel representing a tree.

After several tests, I noticed that, when dataChanged is emitted for a parent node, an attached QTreeView will also refresh all children of that node. While I expected that dataChanged should have been also emitted for all underlying children whose data was modified.

I can't find explicit details in the documentation.

Should I:

  • Emit dataChanged only for the parent node, and all child nodes will be updated?
  • Emit dataChanged for all modified children as well, in that case the observed behavior is just a lack of optimization from QTreeView
0 Answers
Related