Qt中QTreeWidget(QTreeView)样式设置

Qt中各控件样式设置 专栏收录该内容
6 篇文章 0 订阅
QTreeView {    
	background-color: rgb(35, 40, 49);
    outline: 0px;                 /*消除QTreeWidgetItem外层虚线框*/
	border: 0px solid #000000;
}
QTreeView::item {
     border: 1px solid #000000;
    border-top-color: transparent;
	border-left-color: transparent;
	height:75px;
	padding-left:28px; 
}

QTreeView::item:hover {    
	background-image: url(:/鼠标经过.png);    
}

QTreeView::item:selected {    
	border-image: url(:/点击.png);
}

QTreeView::item:selected:active{  
}

QTreeView::item:selected:!active {   
}
/*分支显示*/
QTreeView::branch {
	subcontrol-origin: padding;
    subcontrol-position: right;     
	border: 1px solid #000000;	
    border-top-color: transparent;
	border-left-color: transparent;  
	border-right-color: transparent;	
}

/*QTreeView::branch:!has-children:!has-siblings:adjoins-item {
        background: yellow;
}*/

QTreeView::branch:has-children:!has-siblings:closed,
QTreeView::branch:closed:has-children:has-siblings {	
	image: url(:/常态.png);	
	max-width:54px;	
	min-width:54px;	
}
QTreeView::branch:has-children:!has-siblings:closed:hover,
QTreeView::branch:closed:has-children:has-siblings:hover {		
	image: url(:/鼠标经过.png);
	max-width:54px;	
	min-width:54px;	
}

QTreeView::branch:open:has-children:!has-siblings,
QTreeView::branch:open:has-children:has-siblings {		
	image: url(:/常态.png);	
	min-width: 68px;
    min-height: 28px;
}
QTreeView::branch:open:has-children:!has-siblings:hover,
QTreeView::branch:open:has-children:has-siblings:hover {	
	image: url(:/鼠标经过.png);	
}

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

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

显示效果如下图所示:

 

  • 1
    点赞
  • 3
    评论
  • 6
    收藏
  • 一键三连
    一键三连
  • 扫一扫,分享海报

©️2021 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值