QLabel渐变色背景的快速设定
参考官方文档
可以找到答案!
如下:
https://doc.qt.io/archives/qt-5.5/stylesheet-examples.html
效果图:
代码如下:
self.label.setStyleSheet('''
QLabel{
background-color:
qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
stop: 0.5 #9af3fb, stop: 0.8 #16c8ff,
stop: 0.5 #74d8fb, stop: 1.0 #2399ff);} ## “#”号后面为色值!
''')
官方文档:
QComboBox:!editable:on, QComboBox::drop-down:editable:on {
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
stop: 0 #D3D3D3, stop: 0.4 #D8D8D8,
stop: 0.5 #DDDDDD, stop: 1.0 #E1E1E1);
虽控件不一样,但是可通用!