1. 前言
项目需要用到样式表设置界面,但是写样式表的时候没办法即时查看效果,很不方便,所以做了一个小工具,支持实时修改样式表并即时查看样式表效果,支持几个常用的Qt控件。
2. 注意事项
subcontrol-origin 有 4 个值可选:
margin
border
padding
content
subcontrol-position 水平方向有 3 个值可选:
left
center
right
subcontrol-position 垂直方向有 3 个值可选:
top
center
bottom
QComboBox要设置下拉框(QListView)的样式,必须首先设置这个
ui->comboBox_display->setView(new QListView());
QCheckBox默认只有两种状态,设置此项打开第三种状态
ui->checkBox_display->setTristate(true); // 打开不确定状态
QLineEdit echoMode为2时,设置密文显示为其他值,此值是ASCII码值,常用的:35-'#',42-'*',9569-'●'
QTableView设置交替行颜色,首先要把这个属性置为true
ui->tableView->setAlternatingRowColors(true);
QCalendar布局:
3. 源码链接
4. 参考
https://doc.qt.io/qt-5/stylesheet-reference.html
http://qtdebug.com/qtbook-qss-calendar/
https://gitee.com/BigBossQzz/PyQt/blob/master/QCalendarWidget/CalendarQssStyle.py
https://blog.csdn.net/hyongilfmmm/article/details/83190358
https://blog.csdn.net/Andy_93/article/details/53099813