QSS实践汇总(2)——QTreeWidget、QTreeView样式(风格)

1、特别说明

(1)树形结构的的伸缩线条有严格要求,测试时有时未生效

(2)仿照Qt助手中的文档

Qt助手查询qss步骤

打开Qt助手——>索引处输入stylesheet——>右侧

2、QSS效果展示

QSS实践汇总(2)——QTreeWidget、QTreeView样式(风格)_第1张图片

QTreeView{

background:transparent;

outline:0px;

border:none;

color:rgb(255,255,255);

margin-left:45px;

margin-top:20px;

font-size:14px;

}

QTreeView::item{

height:35px;

}

QTreeView::item:hover{

background:transparent;

color:rgb(19,154,230);

}

QTreeView::item:selected{

color:rgb(255,255,255);

background-color:rgba(3,155,252,50);

border-radius:4px;

}

QTreeView QHeaderView::section{

background:transparent;

height:0px;

}

QTreeView::branch:has-siblings:!adjoins-item {

    border-image: url(:/commonImg/Resources/image/common/Tree/vline.png) 0;

 }

 QTreeView::branch:has-siblings:adjoins-item {

     border-image: url(:/commonImg/Resources/image/common/Tree/branch-more.png) 0;

 }

  QTreeView::branch:!has-children:!has-siblings:adjoins-item {

     border-image: url(:/commonImg/Resources/image/common/Tree/branch-end.png) 0;

 }

 QTreeView::branch:has-children:!has-siblings:closed,

 QTreeView::branch:closed:has-children:has-siblings {

         border-image: none;

         image: url(:/commonImg/Resources/image/common/Tree/branch-closed.png);

 }

 QTreeView::branch:open:has-children:!has-siblings,

 QTreeView::branch:open:has-children:has-siblings  {

         border-image: none;

         image: url(:/commonImg/Resources/image/common/Tree/branch-open.png);

 }

 

你可能感兴趣的:(qt,开发语言)