I'd like to remove expandable attribute on some elements in QTreeView (populated with model inherited from QFileSystemModel). I can easily collapse this elements right after they are expanded, but they will be still visible in QTreeView as expandable. How can I show them as unexpandable ones?
Asked
Active
Viewed 380 times
1 Answers
-1
I believe you just have to override the default behaviour in the rowCount
of your QFileSystemModel
derived class to return zero rows for when that QModelIndex
of the row you don't want to be expandable.
See http://qt-project.org/doc/qt-5.0/model-view-programming.html#models particularly the Tree Model diagram.

Matthew
- 2,759
- 18
- 28