能不能给我推荐几个QT中横板的QSlider的样式表,最好是黑红配色的
时间: 2023-03-20 14:02:14 浏览: 245
当然可以!以下是几个黑红配色的QSlider样式表,它们可以让你的QSlider变得更加酷炫:
1. 简单的黑红横条样式表:
```
QSlider {
border: 1px solid #bbb;
background: #333;
}
QSlider::groove:horizontal {
border: 1px solid #bbb;
height: 10px;
background: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 #222, stop:1 #444);
}
QSlider::handle:horizontal {
background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #eee, stop:1 #ccc);
border: 1px solid #777;
width: 20px;
height: 20px;
margin: -5px 0;
border-radius: 10px;
}
```
2. 棱角分明的黑红横条样式表:
```
QSlider {
border: 1px solid #bbb;
background: #333;
}
QSlider::groove:horizontal {
border: 1px solid #bbb;
height: 10px;
background: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 #222, stop:1 #444);
margin: 0 16px;
}
QSlider::handle:horizontal {
background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #eee, stop:1 #ccc);
border: 1px solid #777;
width: 20px;
height: 20px;
margin: -5px 0;
border-radius: 10px;
}
QSlider::sub-page:horizontal {
background: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 #f00, stop:1 #800);
border: 1px solid #777;
}
QSlider::add-page:horizontal {
background: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 #f00, stop:1 #800);
border: 1px solid #777;
}
```
3. 漆黑背景,鲜艳红色横条样式表:
```
QSlider {
border: none;
background: #111;
}
QSlider::groove:horizontal {
border: none;
height: 8px;
background: #222;
margin: 0 8px;
}
QSlider::handle:horizontal {
background: #f00;
border: none;
width: 16px;
height: 16px;
margin: -4px 0;
border-radius: 8px;
}
QSlider::sub-page:horizontal {
background: #f00;
border: none;
}
QSlider::add-page:horizontal {
background: #f00;
border: none;
}
```
你可以将这些样式表应用到你的QSlider控件中,方法如下:
```python
# 导入Qt
阅读全文