From 6e6217977f375a7feabb4f8f9edb04506566e254 Mon Sep 17 00:00:00 2001 From: MarcusStill <69536339+MarcusStill@users.noreply.github.com> Date: Sat, 29 Aug 2026 17:05:52 +0000 Subject: [PATCH] feat: Modernize PySide6 GUI with Windows 10/11 QSS styling --- files/style.qss | 160 ++++++++++++++++++++++++++++++++++++++++++++++++ main.py | 8 +++ 2 files changed, 168 insertions(+) create mode 100644 files/style.qss diff --git a/files/style.qss b/files/style.qss new file mode 100644 index 0000000..b66d0a5 --- /dev/null +++ b/files/style.qss @@ -0,0 +1,160 @@ +/* files/style.qss */ +QWidget { + font-family: "Segoe UI", "San Francisco", "Helvetica Neue", sans-serif; + font-size: 10pt; + color: #1c1c1c; + background-color: #f3f3f3; +} + +QMainWindow, QDialog { + background-color: #ffffff; +} + +QPushButton { + background-color: #e1e1e1; + border: 1px solid #adadad; + border-radius: 4px; + padding: 6px 16px; + color: #000000; +} + +QPushButton:hover { + background-color: #e5f1fb; + border: 1px solid #0078D4; +} + +QPushButton:pressed { + background-color: #cce4f7; + border: 1px solid #005499; +} + +QPushButton:disabled { + background-color: #f0f0f0; + border: 1px solid #d9d9d9; + color: #a0a0a0; +} + +QLineEdit, QTextEdit, QPlainTextEdit, QComboBox, QSpinBox, QDoubleSpinBox, QDateEdit, QTimeEdit, QDateTimeEdit { + background-color: #ffffff; + border: 1px solid #cccccc; + border-radius: 4px; + padding: 4px 8px; + selection-background-color: #0078D4; + selection-color: #ffffff; +} + +QLineEdit:focus, QTextEdit:focus, QPlainTextEdit:focus, QComboBox:focus, QSpinBox:focus, QDoubleSpinBox:focus, QDateEdit:focus, QTimeEdit:focus, QDateTimeEdit:focus { + border: 1px solid #0078D4; +} + +QComboBox::drop-down { + subcontrol-origin: padding; + subcontrol-position: top right; + width: 20px; + border-left-width: 0px; +} + +QTableView, QTableWidget { + background-color: #ffffff; + alternate-background-color: #f9f9f9; + border: 1px solid #cccccc; + gridline-color: #e0e0e0; + selection-background-color: #cce4f7; + selection-color: #000000; +} + +QHeaderView::section { + background-color: #f0f0f0; + border: none; + border-right: 1px solid #cccccc; + border-bottom: 1px solid #cccccc; + padding: 4px; + font-weight: 600; +} + +QTabWidget::pane { + border: 1px solid #cccccc; + background-color: #ffffff; +} + +QTabBar::tab { + background-color: #e1e1e1; + border: 1px solid #cccccc; + padding: 6px 12px; + margin-right: 2px; +} + +QTabBar::tab:selected { + background-color: #ffffff; + border-bottom-color: #ffffff; +} + +QTabBar::tab:hover:!selected { + background-color: #e5f1fb; +} + +QScrollBar:vertical { + border: none; + background: #f0f0f0; + width: 12px; + margin: 0px 0 0px 0; +} + +QScrollBar::handle:vertical { + background: #c0c0c0; + min-height: 20px; + border-radius: 6px; + margin: 2px; +} + +QScrollBar::handle:vertical:hover { + background: #a0a0a0; +} + +QScrollBar::add-line:vertical, QScrollBar::sub-line:vertical { + border: none; + background: none; +} + +QScrollBar:horizontal { + border: none; + background: #f0f0f0; + height: 12px; + margin: 0px 0 0px 0; +} + +QScrollBar::handle:horizontal { + background: #c0c0c0; + min-width: 20px; + border-radius: 6px; + margin: 2px; +} + +QScrollBar::handle:horizontal:hover { + background: #a0a0a0; +} + +QScrollBar::add-line:horizontal, QScrollBar::sub-line:horizontal { + border: none; + background: none; +} + +QGroupBox { + border: 1px solid #cccccc; + border-radius: 4px; + margin-top: 10px; +} + +QGroupBox::title { + subcontrol-origin: margin; + subcontrol-position: top left; + padding: 0 3px; + color: #0078D4; +} + +QToolTip { + background-color: #ffffff; + border: 1px solid #cccccc; + color: #000000; + padding: 2px; +} diff --git a/main.py b/main.py index c7f54d0..9f86bad 100644 --- a/main.py +++ b/main.py @@ -3556,6 +3556,14 @@ class Payment: if __name__ == "__main__": app = QtWidgets.QApplication(sys.argv) app.setStyle("Fusion") + + style_path = Path(__file__).parent / "files" / "style.qss" + if style_path.exists(): + with open(style_path, "r", encoding="utf-8") as f: + app.setStyleSheet(f.read()) + else: + logger.warning(f"Файл стилей не найден: {style_path}") + auth = AuthForm() auth.show() auth.ui.label_9.setText(system.database)