QT——部分QT控件的QSS样式及用法

setObjectName();使用QSS的函数

QPushButton#weilaiditanP:checked
{
    image: url(:/resources/weilaiditan.png);
	background-image: url(:/resources/nidebeijing.png);
	background-color: transparent;
	border:none;
}
QPushButton#weilaiditanP:!checked
{
	image: url(:/resources/weilaiditan.png);
	background-color: transparent;
	border:none;
}
QPushButton#weilaiditanP:hover
{
    image: url(:/resources/weilaiditan.png);
	background-image: url(:/resources/nidebeijing.png);
	background-color: transparent;
	border:none;
}
QLabel#tiaotiao
{
    background: transparent;
    border:none;
    background:url(:/resources/tiaotiao.png);
}
QTextEdit
{
	max-width:250px;
	border:1px solid rgba(0,182,250,1);
	font-size:14px;
	font-family:Microsoft YaHei;
	font-weight:bold;
	color:rgba(255,255,255,1);
	background: transparent;
}
QLineEdit#machineID
{
	width:340px;
	border:1px solid rgba(0,182,250,1);
	background: transparent;
	font-size:16px;
	font-family:Microsoft YaHei;
	font-weight:bold;
	color:rgba(110,123,132,1);
	line-height:120px;
}
QTreeWidget
{
	background-color: transparent;
	border: none;
	font-size:14px;
	font-family:Microsoft YaHei;
	font-weight:bold;
	color:rgba(255,255,255,1);
	line-height:120px;
	width:150px;
}
QTreeWidget::branch:has-children:!has-siblings:closed,QTreeView::branch:closed:has-children:has-siblings
{
	border-image: none; 
	image: url(:/resources/treeNoExp.png);
}
QTreeWidget::branch:open:has-children:!has-siblings,QTreeView::branch:open:has-children:has-siblings
{
	border-image: none; 
	image: url(:/resources/treeExp.png);
}
QTreeWidget::branch:has-siblings:!adjoins-item {
    border-image: url(:/Resources/vline.png) 0;
 }
 QTreeWidget::branch:has-siblings:adjoins-item {
    border-image: url(:/Resources/branch-more.png) 0;
 }
 QTreeWidget::branch:!has-children:!has-siblings:adjoins-item {
    border-image: url(:/Resources/branch-end.png) 0;
 }
QTreeView::indicator{
	background: transparent;
}
QTreeView::indicator:enabled:unchecked
{
	image: url(:/Resources/uncheck.png);
}
QTreeView::indicator:enabled:checked
{
	image: url(:/Resources/checked.png);
}
QScrollBar:vertical {
	border: 0px;
	background-color:transparent;
	width: 8px;
	margin-top: 0px;
	margin-bottom: 0px;
	margin-left: 5px;
}
QScrollBar::add-page:vertical,QScrollBar::sub-page:vertical
{
    background: none;
}
QScrollBar::handle:vertical{
	background: rgb(91,217,255);
	min-height: 20px;
	width:4px;
	border-radius: 3px;
}
QScrollBar::add-line:vertical{
	border: 0px;
	height: 0px;
}
QScrollBar::sub-line:vertical{
	border: 0px;
	height: 0px;
} 
QScrollBar:horizontal {
	border: 0px;
	background-color:transparent;
	height: 4px;
	margin-top: 0px;
	margin-bottom: 0px;
	margin-left: 5px;
}
QScrollBar::add-page:horizontal,QScrollBar::sub-page:horizontal
{
    background: none;
}
QScrollBar::handle:horizontal{
	background: rgb(91,217,255);
	min-height: 20px;
	width:4px;
	border-radius: 3px;
}
QScrollBar::add-line:horizontal{
	border: 0px;
	height: 0px;
}
QScrollBar::sub-line:horizontal{
	border: 0px;
	height: 0px;
}
QMenu{	
	background: rgba(23, 114, 205, 0.5);
	border: 1px solid #0080FF;
}
QMenu::item{
	width: 57px;
	height: 14px;
	font-size: 14px;
	font-family: Microsoft YaHei;
	font-weight: 400;
	color: #FFFFFF;
	line-height: 27px;
	padding:8px 32px;
}
QMenu::item:selected
{
	width:90px;
	height:34px;
	background:rgba(150,149,149,0.3);
}
QTimeEdit
{
	width:160px;
	height:36px;
	border:1px solid rgba(59,171,242,1);
	background: transparent;
	font-size:24px;
	font-family:Adobe Heiti Std;
	font-weight:normal;
	color:rgba(255,255,255,1);
}
QSlider{
border-color: #bcbcbc;
}
QSlider::groove:horizontal {                                
     border: 1px solid #999999;                             
     height: 1px;                                           
    margin: 0px 0;                                         
     left: 5px; right: 10px; 
 }
QSlider::handle:horizontal {                               
     border: 0px ;                           
     border-image:  url(:/resources/sliderBtn.png);
     width: 15px;                                           
     margin: -7px -7px -7px -7px;                  
}
QSlider::handle:horizontal:hover {                               
     border: 0px ;                           
     border-image:  url(:/resources/sliderOnBtn.png);
     width: 15px;                                           
     margin: -7px -7px -7px -7px;                  
}
QSlider::add-page:horizontal{
 background: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 #bcbcbc, stop:0.25 #bcbcbc, stop:0.5 #bcbcbc, stop:1 #bcbcbc); 
}
QSlider::sub-page:horizontal{                               
 background: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 #439cf3, stop:0.25 #439cf3, stop:0.5 #439cf3, stop:1 #439cf3);                     
}
QSlider#slider2
{
	border-color: rgb(113,113,113);
	height:11px;
}
QSlider::groove:horizontal#slider2
{                                
     border: 1px solid #999999;                             
     height: 11px;                                           
     margin: 0px 0;                                         
     left: 10px; right: 10px; 
 }
QSlider::add-page:horizontal#slider2
{
	background: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 rgb(113,113,113), stop:0.25 rgb(113,113,113), stop:0.5 rgb(113,113,113), stop:1 rgb(113,113,113)); 
}
QSlider::sub-page:horizontal#slider2
{                               
	background: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 rgb(32, 156, 255), stop:0.25 rgb(32, 156, 255), stop:0.5 rgb(32, 156, 255), stop:1 rgb(32, 156, 255));                     
}
QComboBox
{
 width:72px;
 height:18px;
 border:1px solid rgba(0,182,250,1);
 font-size:12px;
 font-family:Microsoft YaHei;
 font-weight:bold;
 color: #FFFFFF;
 line-height: 30px;
 background: transparent;
}
QComboBox::drop-down {
   subcontrol-position: right center;
   subcontrol-origin: padding;
   image: url(:/resources/actionbtn.png);
}
QComboBox::down-arrow {
   image: url(:/resources/actionbtn.png);
}
/* 下拉后,整个下拉窗体样式 */
QComboBox QAbstractItemView {
    outline: 0px solid gray;   /* 选定项的虚框 */
    border: 1px solid #0090FF;   /* 整个下拉窗体的边框 */
    background-color: #0080FF;   /* 整个下拉窗体的背景色 */
    selection-background-color: #0090FF;   /* 整个下拉窗体被选中项的背景色 */
}
QComboBox#infoComb
{
 	width:230px;
	height:23px;
	border:1px solid rgba(0,182,250,1);
	font-size:14px;
	font-family:Microsoft YaHei;
	font-weight:bold;
	color: #FFFFFF;
	line-height: 30px;
	background: transparent;
}
QComboBox::drop-down#infoComb{
   subcontrol-position: right center;
   subcontrol-origin: padding;
   image: url(:/resources/actionbtn.png);
}
QComboBox::down-arrow#infoComb{
   image: url(:/resources/actionbtn.png);
}
/* 下拉后,整个下拉窗体样式 */
QComboBox QAbstractItemView#infoComb{
    outline: 0px solid gray;   /* 选定项的虚框 */
    border: 1px solid #0090FF;   /* 整个下拉窗体的边框 */
    background-color: #0080FF;   /* 整个下拉窗体的背景色 */
    selection-background-color: #0090FF;   /* 整个下拉窗体被选中项的背景色 */
}

你可能感兴趣的:(QT)