I want to have my QTreeView
always expanded all of the items. In that case, all expand button / decoration are unnecessary and I want get rid of them. How can I delete all of them? setRootIsDecorated
will only delete that buttons on first level...
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
This is what I've done in the past for this problem, it's a bit of a hack but it's worked pretty well. In this case none.png
doesn't exist.
treeView->setStyleSheet( "QTreeView::branch { border-image: url(none.png); }" );
回答2:
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.