隐藏左侧的小箭头
: bool
treeView.setRootIsDecorated(False)
或者
treeView.setStyleSheet( "QTreeView::branch {image:none;}" )
设置item不同状态下显示背景色的代码,设置方法同上: 源码中设置:
treeWidget->setStyleSheet( "QTreeView::item:hover{background-color:rgb(0,255,0,50)}" "QTreeView::item:selected{background-color:rgb(255,0,0,100)}" ); 在样式设置界面,添加如下两句: QTreeView::item:hover{background-color:rgb(0,255,0,50)} QTreeView::item:selected{background-color:rgb(255,0,0,100)}