Qt常用样式表

1.常用属性
background-color:transparent;			//背景颜色
font-family: Microsoft YaHei;			//字体
font-size: 24px;						//字体大小
color: #000000;							//字体颜色
border-image: url();					//背景图,一般不使用background-image
border-width: 2px;						//边框宽
border-color:							//边框颜色
	border-top-color
	border-bottom-color
	border-left-color
	border-right-color
selection-color							//选中字体颜色
selection-background-color				//选中背景颜色

background-color:						//渐变背景色		
	qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, 
	stop:0 rgba(0, 0, 0, 255), 
	stop:1 rgba(255, 255, 255, 255))	
	
border-radius: 4px;						//设置圆角
     border-top-right-radius
     border-top-left-radius
     border-bottom-right-radius
     border-bottom-left-radius
border: 1px solid #2F8DED;				//边框1像素,颜色
	border-top;
	border-bottom;
	border-left;
	border-right;
border: none;							//无边框

margin:4px								//边距
	margin-top;
	margin-right;
	margin-bottom;
	margin-left;
	
padding:6px								//内边距	
	padding-top
	padding-right
	padding-bottom
	padding-left

text-align: left;						//对齐方式


2.QPushButton
qproperty-icon: url();					//设置图标居左,文字居右
qproperty-iconSize: 20px 20px;			//设置图标大小

QPushButton:checked						//选中
QPushButton:unchecked 					//未选中
QPushButton:pressed 					//按下
QPushButton:hover 						//悬停

3.QCheckBox
QCheckBox 
{
	spacing: 5px;						//间距
}
QCheckBox::indicator 
{
  width: 13px;
  height: 13px;
}
QCheckBox::indicator:unchecked			//未选中同上
QCheckBox::indicator:unchecked:hover
QCheckBox::indicator:unchecked:pressed
QCheckBox::indicator:checked
QCheckBox::indicator:checked:hover
QCheckBox::indicator:checked:pressed

4.QListView
QListView 
{
  alternate-background-color: yellow;	//交替背景颜色
}
QListView::item:selected
QListView::item:selected:!active
QListView::item:selected:active
QListView::item:hover

5.QMenu
QMenu::item
QMenu::item:selected
QMenu::icon:checked
QMenu::separator						//菜单分隔符
QMenu::indicator

6.QProgressBar
QProgressBar::chunk						//进度条中间的小条目 
{
  background-color: #05B8CC;
  width: 20px;
}

7.QRadioButton
QRadioButton::indicator::unchecked
QRadioButton::indicator:unchecked:hover
QRadioButton::indicator:unchecked:pressed
QRadioButton::indicator::checked
QRadioButton::indicator:checked:hover
QRadioButton::indicator:checked:pressed

8.QScrollBar
QScrollBar:vertical 
{
	border:0px solid red;
	background-color:#FAFAFA;
	width:6px;
	margin:0 0 0 0px;
}
/* 底部控制块 */
 QScrollBar::add-line:vertical {
 border:none;
 background:transparent; 
 height:0px;
}
 /* 顶部控制块 */ 
QScrollBar::sub-line:vertical { 
 border:none; 
 background:transparent; 
 height:0px; 
 subcontrol-position:top;
 subcontrol-origin:margin;

}
/* 滑块设置 */
QScrollBar::handle:vertical {
	background: #DCDFE6;
	min-height:200px;
	border-radius: 3px;
}
 /* 滑块上边区域 */ 
QScrollBar::add-page:vertical {
 background:transparent;
} 
/* 滑块下边区域 */
 QScrollBar::sub-page:vertical {
 background:transparent; 
}

9.QSpinBox
QSpinBox::up-button					//上按钮
QSpinBox::up-button:hover
QSpinBox::up-button:pressed
QSpinBox::up-arrow										//上箭头设置
QSpinBox::up-arrow:disabled, QSpinBox::up-arrow:off	//值为最大时关闭状态
QSpinBox::down-button				//下按钮
QSpinBox::down-button:hover
QSpinBox::down-button:pressed
QSpinBox::down-arrow									//下箭头设置
QSpinBox::down-arrow:disabled,QSpinBox::down-arrow:off	//值为最小时关闭状态

10.QSlider
QSlider::groove:horizontal						//水平滑动条槽
QSlider::handle:horizontal						//水平滑块
QSlider::groove:vertical
QSlider::handle:vertical
QSlider::add-page:vertical
QSlider::sub-page:vertical

11.QTabWidget
QTabWidget::pane								//框架
QTabWidget::tab-bar								//选项卡
QTabBar::tab:selected, QTabBar::tab:hover
QTabBar::tab:selected
QTabBar::tab:!selected

12.QTableView
QTableView QTableCornerButton::section 			//项里面按钮选中
{
  background: red;
  border: 2px outset red;
}
QTableView::indicator:unchecked

13.QTreeView
QTreeView::item
QTreeView::item:hover
QTreeView::item:selected
QTreeView::item:selected:active
QTreeView::item:selected:!active
QTreeView::branch								//分支

14.QListView
QListView::item:alternate
QListView::item:selected
QListView::item:selected:!active
QListView::item:selected:active
QListView::item:hover

15.QComboBox
QComboBox:editable								//可编辑
QComboBox:!editable, QComboBox::drop-down:editable		//下拉编辑
QComboBox:!editable:on
QComboBox::drop-down:editable:on
QComboBox::down-arrow:on
QComboBox::down-arrow
QComboBox:on

 

你可能感兴趣的:(Qt入门)