From d9c6be0a9d232f73269da720bf7c0f4dfa1b9329 Mon Sep 17 00:00:00 2001 From: Raffson Date: Mon, 25 Jul 2022 03:06:41 +0200 Subject: [PATCH] Refactor 'grey-out' CSS The CSS used to grey out the checkbox and label for advanced IADS should be refactored so it can be reused for disabling player checkboxes in the flight edit/create dialogs. The solution is applied to all checkboxes/labels, so that there's a consistent way of showing users when a checkbox/label is disabled. --- qt_ui/windows/newgame/QNewGameWizard.py | 3 --- resources/stylesheets/style-dcs.css | 11 +++++++++++ resources/stylesheets/style.css | 11 +++++++++++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/qt_ui/windows/newgame/QNewGameWizard.py b/qt_ui/windows/newgame/QNewGameWizard.py index 6ad41543..882f471a 100644 --- a/qt_ui/windows/newgame/QNewGameWizard.py +++ b/qt_ui/windows/newgame/QNewGameWizard.py @@ -393,11 +393,8 @@ class TheaterConfiguration(QtWidgets.QWizardPage): mapSettingsLayout.addWidget(QtWidgets.QLabel("Invert Map"), 0, 0) mapSettingsLayout.addWidget(invertMap, 0, 1) self.advanced_iads = QtWidgets.QCheckBox() - disabled_grey_out = "QCheckBox::indicator:disabled{ background-color: rgba(255, 255, 255, 5%); }" - self.advanced_iads.setStyleSheet(disabled_grey_out) self.registerField("advanced_iads", self.advanced_iads) self.iads_label = QtWidgets.QLabel("Advanced IADS (WIP)") - self.iads_label.setStyleSheet("QLabel:disabled{color: #888888}") mapSettingsLayout.addWidget(self.iads_label, 1, 0) mapSettingsLayout.addWidget(self.advanced_iads, 1, 1) mapSettingsGroup.setLayout(mapSettingsLayout) diff --git a/resources/stylesheets/style-dcs.css b/resources/stylesheets/style-dcs.css index 1dc01e71..9ade529c 100644 --- a/resources/stylesheets/style-dcs.css +++ b/resources/stylesheets/style-dcs.css @@ -231,6 +231,10 @@ QLabel{ border: none; } +QLabel:disabled { + color: #888888; +} + QLabel[style="base-title"]{ font-size: 24px; } @@ -383,6 +387,13 @@ QGroupBox::indicator:checked , QCheckBox::indicator:checked { image: url(resources/stylesheets/check.png); } +QCheckBox:disabled { + color: #888888; +} +QCheckBox::indicator:disabled { + background-color: rgba(255, 255, 255, 5%); +} + /*QDialog*/ QDialog{ diff --git a/resources/stylesheets/style.css b/resources/stylesheets/style.css index ea65ffd1..79259367 100644 --- a/resources/stylesheets/style.css +++ b/resources/stylesheets/style.css @@ -191,4 +191,15 @@ QWidget[style="baseMenuHeader"]{ QLabel[style="small"]{ font-size: 8px; +} + +QCheckBox:disabled { + color: #888888; +} +QCheckBox::indicator:disabled { + background-color: rgba(255, 255, 255, 5%); +} + +QLabel:disabled { + color: #888888; } \ No newline at end of file