문제

I have a QTreeView with a QFileSystemModel as its model.

I can't figure out how to limit the depth of the tree. I would have thought it would be a function of the model?

What I mean is, if I set the depth to 1, for example, only the top level items would be shown (i.e no expand buttons on folders)

A depth of one would make the tree look like bog-standard details view in windows explorer.

I'm using PySide, but I can understand answers in PyQt or C++.

도움이 되었습니까?

해결책

Not sure if this is what you're looking for, but if you're viewing the model with a QTreeView you can set the view's itemsExpandable and rootIsDecorated properties to false.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top