一、简述
QSS:全称 Qt Style Sheets(Qt样式表),用于美化Qt程序界面,类似于CSS,但不如CSS强大,选择器和属性较少。Qt定制化CSS。
QSS可以通过控件对象的setStyleSheet方法设置控件样式。
二、控件样式设置
2.1边框线
2.1.1按钮QPushButton
//线粗细:1px
//线类型:solid实线
border:1px solid;
2.2背景色/字体颜色
2.2.1表格表行头/列头颜色
行头颜色(行列交叉也设置背景颜色):
QHeaderView::section::horizontal,QTableCornerButton:section{ padding:3px; margin:0px; color:#DCDCDC; border:1px solid #242424; border-left-width:0px; border-right-width:1px; border-top-width:0px; border-bottom-width:1px; background:qlineargradient(spread:pad,x1:0,y1:0,x2:0,y2:1,stop:0 #646464,stop:1 #525252); } QTableWidget{background-color:white;border:none;}
QTableWidget::item:hover{background-color:rgb(92,188,227,200)}
QTableWidget::item:selected{background-color:#1B89A1}
列头颜色:
QHeaderView::section::vertical,QT