我希望我的QTreeView
始终展开所有项目。在这种情况下,所有展开按钮/装饰都是不必要的,我想摆脱它们。如何删除所有这些? setRootIsDecorated
只会删除第一级的按钮...
答案 0 :(得分:17)
这是我过去为这个问题所做的,它有点像黑客但它的效果非常好。在这种情况下,none.png
不存在。
treeView->setStyleSheet( "QTreeView::branch { border-image: url(none.png); }" );
答案 1 :(得分:4)
See https://forum.qt.io/topic/4767/how-to-get-rid-of-expande-collapse-qtreewidgetitem-indicator
This got rid of the top level ones for me: self.setRootIsDecorated(False)
.
I didn't try the item polocy mentioned so I'm not sure this answer can be considered complete. If anyone can verify, feel free to edit this with the confirmation. Until then consider this answer an info-share.