QTreeWidget设置stylesheet的一个问题

时间:2022-09-05 18:48:13
背景设成了黑色。

树中可以收起展开的父节点的那个小三角怎么改样式表?想把颜色改成白色的。

3 个解决方案

#1


没人知道么~

#2



 QTreeView::branch:has-siblings:!adjoins-item {
     border-image: url(vline.png) 0;
 }

 QTreeView::branch:has-siblings:adjoins-item {
     border-image: url(branch-more.png) 0;
 }

 QTreeView::branch:!has-children:!has-siblings:adjoins-item {
     border-image: url(branch-end.png) 0;
 }

 QTreeView::branch:has-children:!has-siblings:closed,
 QTreeView::branch:closed:has-children:has-siblings {
         border-image: none;
         image: url(branch-closed.png);
 }

 QTreeView::branch:open:has-children:!has-siblings,
 QTreeView::branch:open:has-children:has-siblings  {
         border-image: none;
         image: url(branch-open.png);
 }



branch-closed.png
branch-open.png


一个是收起的小三角 一个是展开的小三角

#3


麻烦问下背景黑色是怎么设置的啊?

#1


没人知道么~

#2



 QTreeView::branch:has-siblings:!adjoins-item {
     border-image: url(vline.png) 0;
 }

 QTreeView::branch:has-siblings:adjoins-item {
     border-image: url(branch-more.png) 0;
 }

 QTreeView::branch:!has-children:!has-siblings:adjoins-item {
     border-image: url(branch-end.png) 0;
 }

 QTreeView::branch:has-children:!has-siblings:closed,
 QTreeView::branch:closed:has-children:has-siblings {
         border-image: none;
         image: url(branch-closed.png);
 }

 QTreeView::branch:open:has-children:!has-siblings,
 QTreeView::branch:open:has-children:has-siblings  {
         border-image: none;
         image: url(branch-open.png);
 }



branch-closed.png
branch-open.png


一个是收起的小三角 一个是展开的小三角

#3


麻烦问下背景黑色是怎么设置的啊?