请帮我设计一套PyQt6暗黑风格的qss样式 要求是有PYQT6的所有控件都要参与设计
时间: 2024-05-07 08:20:35 浏览: 219
PyqtQSS样式(黑、白、蓝)
好的,以下是一套简单的PyQt6暗黑风格的qss样式,覆盖了PyQt6的所有控件:
```css
/* QAbstractButton */
QAbstractButton {
border: 2px solid #232323;
border-radius: 8px;
padding: 6px 12px;
background-color: #3c3c3c;
color: #fff;
}
QAbstractButton:hover {
background-color: #4c4c4c;
}
QAbstractButton:pressed {
background-color: #2c2c2c;
}
/* QCheckBox */
QCheckBox {
color: #fff;
}
QCheckBox::indicator {
width: 18px;
height: 18px;
}
QCheckBox::indicator:unchecked {
background-color: #3c3c3c;
border: 2px solid #232323;
}
QCheckBox::indicator:checked {
background-color: #1c1c1c;
border: 2px solid #0b0b0b;
}
/* QComboBox */
QComboBox {
border: 2px solid #232323;
border-radius: 8px;
padding: 4px;
background-color: #3c3c3c;
color: #fff;
}
QComboBox:hover {
background-color: #4c4c4c;
}
QComboBox:pressed {
background-color: #2c2c2c;
}
QComboBox::drop-down {
width: 20px;
height: 20px;
subcontrol-position: center right;
subcontrol-origin: padding;
border-left: 2px solid #232323;
border-top-right-radius: 8px;
border-bottom-right-radius: 8px;
background-color: #3c3c3c;
}
QComboBox::down-arrow {
width: 12px;
height: 12px;
image: url(down-arrow.png);
}
/* QGroupBox */
QGroupBox {
border: 2px solid #232323;
border-radius: 8px;
padding: 8px;
background-color: #3c3c3c;
color: #fff;
}
/* QLabel */
QLabel {
color: #fff;
}
/* QLineEdit */
QLineEdit {
border: 2px solid #232323;
border-radius: 8px;
padding: 4px;
background-color: #3c3c3c;
color: #fff;
}
QLineEdit:hover {
background-color: #4c4c4c;
}
QLineEdit:focus {
border: 2px solid #0b0b0b;
}
/* QListView */
QListView {
border: 2px solid #232323;
border-radius: 8px;
background-color: #3c3c3c;
color: #fff;
}
QListView::item:hover {
background-color: #4c4c4c;
}
QListView::item:selected {
background-color: #1c1c1c;
}
/* QProgressBar */
QProgressBar {
border: 2px solid #232323;
border-radius: 8px;
background-color: #3c3c3c;
color: #fff;
}
QProgressBar::chunk {
background-color: #1c1c1c;
}
/* QPushButton */
QPushButton {
border: 2px solid #232323;
border-radius: 8px;
padding: 6px 12px;
background-color: #3c3c3c;
color: #fff;
}
QPushButton:hover {
background-color: #4c4c4c;
}
QPushButton:pressed {
background-color: #2c2c2c;
}
/* QRadioButton */
QRadioButton {
color: #fff;
}
QRadioButton::indicator {
width: 18px;
height: 18px;
}
QRadioButton::indicator:unchecked {
background-color: #3c3c3c;
border: 2px solid #232323;
border-radius: 50%;
}
QRadioButton::indicator:checked {
background-color: #1c1c1c;
border: 2px solid #0b0b0b;
border-radius: 50%;
}
/* QScrollBar */
QScrollBar:vertical {
width: 20px;
background-color: #3c3c3c;
border: 2px solid #232323;
border-radius: 8px;
}
QScrollBar::handle:vertical {
background-color: #4c4c4c;
border-radius: 8px;
}
QScrollBar::handle:vertical:hover {
background-color: #5c5c5c;
}
QScrollBar::handle:vertical:pressed {
background-color: #2c2c2c;
}
QScrollBar::add-line:vertical {
height: 20px;
subcontrol-position: bottom;
subcontrol-origin: margin;
}
QScrollBar::add-line:vertical:hover {
background-color: #4c4c4c;
}
QScrollBar::add-line:vertical:pressed {
background-color: #2c2c2c;
}
QScrollBar::sub-line:vertical {
height: 20px;
subcontrol-position: top;
subcontrol-origin: margin;
}
QScrollBar::sub-line:vertical:hover {
background-color: #4c4c4c;
}
QScrollBar::sub-line:vertical:pressed {
background-color: #2c2c2c;
}
/* QSlider */
QSlider::groove:horizontal {
height: 10px;
background-color: #3c3c3c;
border: 2px solid #232323;
border-radius: 8px;
}
QSlider::handle:horizontal {
width: 20px;
height: 20px;
margin-top: -5px;
margin-bottom: -5px;
background-color: #4c4c4c;
border: 2px solid #232323;
border-radius: 50%;
}
QSlider::handle:horizontal:hover {
background-color: #5c5c5c;
}
QSlider::handle:horizontal:pressed {
background-color: #2c2c2c;
}
/* QSpinBox */
QSpinBox {
border: 2px solid #232323;
border-radius: 8px;
padding: 4px;
background-color: #3c3c3c;
color: #fff;
}
QSpinBox:hover {
background-color: #4c4c4c;
}
QSpinBox:focus {
border: 2px solid #0b0b0b;
}
/* QTabWidget */
QTabWidget::pane {
border: 2px solid #232323;
border-radius: 8px;
background-color: #3c3c3c;
}
QTabBar::tab {
border: 2px solid #232323;
border-top-left-radius: 8px;
border-top-right-radius: 8px;
padding: 4px 12px;
background-color: #3c3c3c;
color: #fff;
}
QTabBar::tab:hover {
background-color: #4c4c4c;
}
QTabBar::tab:selected {
background-color: #1c1c1c;
}
/* QTextEdit */
QTextEdit {
border: 2px solid #232323;
border-radius: 8px;
padding: 4px;
background-color: #3c3c3c;
color: #fff;
}
QTextEdit:hover {
background-color: #4c4c4c;
}
QTextEdit:focus {
border: 2px solid #0b0b0b;
}
/* QToolBar */
QToolBar {
border: none;
background-color: #3c3c3c;
}
QToolBar::handle {
background-color: #4c4c4c;
border-radius: 8px;
}
QToolBar::handle:hover {
background-color: #5c5c5c;
}
QToolBar::handle:pressed {
background-color: #2c2c2c;
}
/* QTreeView */
QTreeView {
border: 2px solid #232323;
border-radius: 8px;
background-color: #3c3c3c;
color: #fff;
}
QTreeView::item:hover {
background-color: #4c4c4c;
}
QTreeView::item:selected {
background-color: #1c1c1c;
}
```
注意:这只是一套简单的样式,如果需要更加细致、丰富的样式,还需要根据实际需求进行调整。另外,如果需要使用图片等资源,需要在CSS中添加相应的路径。
阅读全文