隱藏左側的小箭頭
rootIsDecorated : 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)}
