QSS目前支持三种渐变填充:

  • qlineargradient (线性渐变)
  • qconicalgradient(圆锥渐变)
  • qradialgradient(辐射渐变)

image.png

1 线性

QPushButton {
background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 white, stop: 0.4 gray, stop:1 green);
}

2 圆锥

QPushButton {
background: qconicalgradient(cx:0.5, cy:0.5, angle:30, stop:0 white, stop:1 #00FF00);
}

3 辐射

QPushButton {
background: qradialgradient(cx:0, cy:0, radius: 1,fx:0.5, fy:0.5, stop:0 white, stop:1 green);
}