用QSS帮我写几个有立体感的按键
时间: 2024-02-20 21:59:08 浏览: 80
当然可以!以下是几个具有立体感的按键的QSS样式:
1. 带有阴影的凸起按键样式:
```qss
QPushButton {
background-color: #f0f0f0;
border: none;
border-radius: 5px;
box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
padding: 10px;
}
QPushButton:hover {
background-color: #e0e0e0;
}
```
2. 带有阴影的凹陷按键样式:
```qss
QPushButton {
background-color: #f0f0f0;
border: none;
border-radius: 5px;
box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.3);
padding: 10px;
}
QPushButton:hover {
background-color: #e0e0e0;
}
```
3. 带有渐变效果的凸起按键样式:
```qss
QPushButton {
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
stop: 0 #f0f0f0, stop: 0.5 #e0e0e0, stop: 1.0 #f0f0f0);
border: none;
border-radius: 5px;
box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
padding: 10px;
}
QPushButton:hover {
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
stop: 0 #e0e0e0, stop: 0.5 #f0f0f0, stop: 1.0 #e0e0e0);
}
```
希望这些样式能够满足您的需求!
阅读全文