- qss的作用
- 怎么使用qss
- qss语法详解
- 单个设置
- QPushButton { color: red }
- 多个一起设置
- QPushButton, QLineEdit, QComboBox { color: red }
- 设置所有控件
- * { color: red }
- 根据属性
- QPushButton[flat=”false”] { color: red }
- 不包括子类的设置
- .QPushButton { color: red }
- 指定实例
- QPushButton#okButton { color: red }
- 包含关系的设定,包含子类
- QDialog QPushButton { color: red }
- 设置QDialog 中的所有QPushButton
- 包含关系,不包含子类
- QDialog > QPushButton { color: red }
- 子控件
- QComboBox::drop-down { image: url(dropdown.png) }
- 根据状态
- QComboBox::down-arrow:pressed {...}
- QPushButton:hover {...}
- QRadioButton:!hover { color: red }
- QPushButton:hover:!pressed { color: blue; }
- 指定命名控件
- ns--MyPushButton { background: yellow; }
- 关于作用域
- 包含关系:控件里的其他控件不会自动继承qss
- 继承关系:子类继承父类的qss设置
- 优先级
- 父类设置=子类<指定objname的控件
- 父类和子类哪个起效果看以最后一个出现的设置为准