码迷,mamicode.com
首页 > 其他好文 > 详细

qt QTableView/QTableWidget样式设置

时间:2017-09-25 14:45:12      阅读:548      评论:0      收藏:0      [点我收藏+]

标签:get   之间   -o   cpp   滚动   nat   res   temp   idg   

转载请注明出处:http://www.cnblogs.com/dachen408/p/7591409.html

选中设置:

QTableView::item:selected
{
	background:rgb(0,0,100);
	color:white;
}

表头设置:

QHeaderView::section:first
{
    border-image: url(:/images/expand/tempUser_headBg2.png);
    height: 30px;
	font: 11pt "微软雅黑";
}

QHeaderView::section:middle
{
    border-image: url(:/images/expand/tempUser_headBg2.png);
    height: 30px;
    font: 11pt "微软雅黑";
}

QHeaderView::section:last
{
    border-image: url(:/images/expand/tempUser_headBg4.png);
    height: 30px;
    font: 11pt "微软雅黑";
}

滚动条设置:

QScrollBar:vertical {
	border: 0px;
	background:rgba(255,255,255,0);
	border-image:url(:/images/scrollbar/vertical_scrollBg.png);
	width: 22px;
	margin: 22px 0  22px 0;
}

QScrollBar::handle:vertical {
     border-image:url(:/images/scrollbar/vertical_slide.png);
	width:22px;
min-height:50px;
max-height:200px;
 }

QScrollBar::handle:vertical:hover {
	border-image: url(:/images/scrollbar/vertical_slide_hover.png);
	 width:22px;
min-height:50px;
max-height:200px;
 }

QScrollBar::handle:horizontal:hover {
	border-image: url(:/images/scrollbar/slide.png);
	 width:22px;
min-height:35px;
 }

QScrollBar::handle:vertical:hover {
     border-image:url(:/images/scrollbar/vertical_slide_hover.png);
	width:22px;
 }

 QScrollBar::add-line:vertical {
     border-image:url(:/images/scrollbar/vertical_down.png);
     height: 22px;
     subcontrol-position: bottom;
     subcontrol-origin: margin;

 }
 QScrollBar::add-line:vertical:pressed{
     border-image:url(:/images/scrollbar/vertical_down_down.png);
     height: 22px;
     subcontrol-position: bottom;
     subcontrol-origin: margin;

 }
 QScrollBar::sub-line:vertical {
      border-image:url(:/images/scrollbar/vertical_up.png);
     height:22px;
     subcontrol-position: top;
     subcontrol-origin: margin;
 }
 QScrollBar::sub-line:vertical:pressed {
      border-image:url(:/images/scrollbar/vertical_up_down.png);
     height: 22px;
     subcontrol-position: top;
     subcontrol-origin: margin;
 }
QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {
     background: none;
 }

QScrollBar:horizontal {
	border: 0px;
	background:rgba(255,255,255,0);
	border-image:url(:/images/scrollbar/scrollBg.png);
	height: 22px;
	margin: 0 22px 0  22px;
}

QScrollBar::handle:horizontal {
     border-image:url(:/images/scrollbar/slide.png);
	height:22px;
 }

QScrollBar::handle:vertical:hover {
     border-image:url(:/images/scrollbar/vertical_slide_hover.png);
	width:22px;
 }

 QScrollBar::add-line:horizontal {
     border-image:url(:/images/scrollbar/down.png);
     width: 22px;
     subcontrol-position: right;
     subcontrol-origin: margin;

 }
 QScrollBar::add-line:horizontal:pressed{
     border-image:url(:/images/scrollbar/down_down.png);
     width: 22px;
     subcontrol-position: right;
     subcontrol-origin: margin;

 }
 QScrollBar::sub-line:horizontal {
      border-image:url(:/images/scrollbar/up.png);
     width:22px;
     subcontrol-position: left;
     subcontrol-origin: margin;
 }
 QScrollBar::sub-line:horizontal:pressed {
      border-image:url(:/images/scrollbar/up_down.png);
     width: 22px;
     subcontrol-position: left;
     subcontrol-origin: margin;
 }
QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal {
     background: none;
 }

行之间颜色渐变(alternaingRowColors必须设置为true):

QTableView
{
	background-color: rgb(255, 255, 255); 
	alternate-background-color:#F2F8FF;
}

  

 

qt QTableView/QTableWidget样式设置

标签:get   之间   -o   cpp   滚动   nat   res   temp   idg   

原文地址:http://www.cnblogs.com/dachen408/p/7591409.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!