From 35176caaa7462d96c7f7e631d3ffeb77e25ff5f9 Mon Sep 17 00:00:00 2001 From: MarcusStill <69536339+MarcusStill@users.noreply.github.com> Date: Mon, 24 Aug 2026 16:42:14 +0000 Subject: [PATCH] Apply Windows 10/11 flat design QSS to PySide6 GUI - Created `files/style.qss` with styles mimicking Windows 10/11 - Updated `main.py` to load and apply `style.qss` using `pathlib` - Verified unit tests pass with UI changes applied --- files/style.qss | 239 ++++++++++++++++++++++++++++++++++++++++++++++++ main.py | 9 ++ 2 files changed, 248 insertions(+) create mode 100644 files/style.qss diff --git a/files/style.qss b/files/style.qss new file mode 100644 index 0000000..c3cc4a1 --- /dev/null +++ b/files/style.qss @@ -0,0 +1,239 @@ +/* + PyMASL QSS Style + Windows 10/11 Flat Design +*/ + +/* General styling for all widgets */ +QWidget { + font-family: "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: 13px; + color: #333333; + background-color: #f3f3f3; +} + +/* Base style for main windows and dialogs */ +QMainWindow, QDialog { + background-color: #f3f3f3; +} + +/* Labels */ +QLabel { + background: transparent; + color: #333333; +} + +/* Push Buttons */ +QPushButton { + background-color: #e1e1e1; + border: 1px solid #adadad; + border-radius: 4px; + padding: 6px 16px; + color: #000000; +} + +QPushButton:hover { + background-color: #e5f1fb; + border: 1px solid #0078d7; +} + +QPushButton:pressed { + background-color: #cce4f7; + border: 1px solid #005499; +} + +QPushButton:disabled { + background-color: #cccccc; + color: #888888; + border: 1px solid #bfbfbf; +} + +/* Accent primary buttons (can be applied to Ok/Submit buttons if needed by property) */ +QPushButton#btn_ok, QPushButton#btn_save, QPushButton#login_button { + background-color: #0078d7; + border: 1px solid #0078d7; + color: #ffffff; +} + +QPushButton#btn_ok:hover, QPushButton#btn_save:hover, QPushButton#login_button:hover { + background-color: #005a9e; + border: 1px solid #005a9e; +} + +QPushButton#btn_ok:pressed, QPushButton#btn_save:pressed, QPushButton#login_button:pressed { + background-color: #004578; + border: 1px solid #004578; +} + +/* Line Edits */ +QLineEdit { + background-color: #ffffff; + border: 1px solid #cccccc; + border-radius: 4px; + padding: 4px; + selection-background-color: #0078d7; + selection-color: #ffffff; +} + +QLineEdit:hover { + border: 1px solid #999999; +} + +QLineEdit:focus { + border: 1px solid #0078d7; +} + +QLineEdit:disabled { + background-color: #f3f3f3; + color: #888888; +} + +/* Combo Boxes */ +QComboBox { + background-color: #ffffff; + border: 1px solid #cccccc; + border-radius: 4px; + padding: 4px; + min-height: 20px; +} + +QComboBox:hover { + border: 1px solid #999999; +} + +QComboBox:focus { + border: 1px solid #0078d7; +} + +QComboBox::drop-down { + subcontrol-origin: padding; + subcontrol-position: top right; + width: 20px; + border-left: 1px solid #cccccc; +} + +/* Tab Widgets */ +QTabWidget::pane { + border: 1px solid #cccccc; + background-color: #ffffff; + border-radius: 0px; +} + +QTabBar::tab { + background-color: #e1e1e1; + border: 1px solid #cccccc; + border-bottom: none; + padding: 6px 12px; + margin-right: 2px; + border-top-left-radius: 4px; + border-top-right-radius: 4px; +} + +QTabBar::tab:selected { + background-color: #ffffff; + border-bottom: 2px solid #0078d7; +} + +QTabBar::tab:hover:!selected { + background-color: #e5f1fb; +} + +/* Table Widgets */ +QTableWidget, QTableView { + background-color: #ffffff; + border: 1px solid #cccccc; + gridline-color: #e1e1e1; + selection-background-color: #0078d7; + selection-color: #ffffff; + alternate-background-color: #f9f9f9; +} + +QHeaderView::section { + background-color: #f3f3f3; + border: 1px solid #cccccc; + border-top: none; + border-left: none; + padding: 4px; + font-weight: bold; +} + +QHeaderView::section:checked { + background-color: #e5f1fb; +} + +/* Group Boxes */ +QGroupBox { + border: 1px solid #cccccc; + border-radius: 4px; + margin-top: 10px; + padding-top: 10px; +} + +QGroupBox::title { + subcontrol-origin: margin; + subcontrol-position: top left; + padding: 0 3px; + color: #0078d7; +} + +/* Date/Time Edits */ +QDateEdit, QTimeEdit, QDateTimeEdit { + background-color: #ffffff; + border: 1px solid #cccccc; + border-radius: 4px; + padding: 4px; +} + +QDateEdit:hover, QTimeEdit:hover, QDateTimeEdit:hover { + border: 1px solid #999999; +} + +QDateEdit:focus, QTimeEdit:focus, QDateTimeEdit:focus { + border: 1px solid #0078d7; +} + +/* Scrollbars */ +QScrollBar:vertical { + border: none; + background-color: #f3f3f3; + width: 12px; + margin: 0px 0px 0px 0px; +} + +QScrollBar::handle:vertical { + background-color: #cccccc; + min-height: 20px; + border-radius: 6px; +} + +QScrollBar::handle:vertical:hover { + background-color: #999999; +} + +QScrollBar::add-line:vertical, QScrollBar::sub-line:vertical { + border: none; + background: none; + height: 0px; +} + +QScrollBar:horizontal { + border: none; + background-color: #f3f3f3; + height: 12px; + margin: 0px 0px 0px 0px; +} + +QScrollBar::handle:horizontal { + background-color: #cccccc; + min-width: 20px; + border-radius: 6px; +} + +QScrollBar::handle:horizontal:hover { + background-color: #999999; +} + +QScrollBar::add-line:horizontal, QScrollBar::sub-line:horizontal { + border: none; + background: none; + width: 0px; +} diff --git a/main.py b/main.py index c7f54d0..b48edf3 100644 --- a/main.py +++ b/main.py @@ -3556,6 +3556,15 @@ class Payment: if __name__ == "__main__": app = QtWidgets.QApplication(sys.argv) app.setStyle("Fusion") + + # Load and apply QSS styles + qss_path = Path(__file__).parent / "files" / "style.qss" + if qss_path.exists(): + with open(qss_path, "r", encoding="utf-8") as style_file: + app.setStyleSheet(style_file.read()) + else: + logger.warning(f"QSS style file not found: {qss_path}") + auth = AuthForm() auth.show() auth.ui.label_9.setText(system.database)