From 4d32cd93402309521f6b9104c74a1314b4ed2c9e Mon Sep 17 00:00:00 2001 From: Radu Raul <raul.radu@skywarder.eu> Date: Wed, 31 Jul 2024 20:56:03 +0200 Subject: [PATCH] [Themes] Removed style code from source code and inserted into the stylesheet --- .../groundstation/assets/styles/global.qss | 25 ++++++++++++++++ .../assets/styles/white-mode.qss | 26 +++++++++++++++++ src/shared/Modules/Tabs/TabsModule.cpp | 29 ------------------- 3 files changed, 51 insertions(+), 29 deletions(-) diff --git a/src/entrypoints/groundstation/assets/styles/global.qss b/src/entrypoints/groundstation/assets/styles/global.qss index ef032d1f..826f8a40 100644 --- a/src/entrypoints/groundstation/assets/styles/global.qss +++ b/src/entrypoints/groundstation/assets/styles/global.qss @@ -1049,3 +1049,28 @@ QSplitter[orientation="2"]::handle { border-top: 2px dashed #606060; max-height: 0px; } + +QListWidget { + show-decoration-selected: 1; + color: #d7d6d6; + border: none; + font-weight: bold; + font-size: 16px; +} + +QListWidget::item { + background-color: #494949; + padding-top: 0; + padding-bottom: 0; + padding-left: 10px; + padding-right: 10px; +} + +QListWidget::item:selected { + color: #d7d6d6; + border-width: 0; + border-top-style: solid; + border-top-width: 5px; + border-top-color: #a8a8a9; + background-color: #606060; +} \ No newline at end of file diff --git a/src/entrypoints/groundstation/assets/styles/white-mode.qss b/src/entrypoints/groundstation/assets/styles/white-mode.qss index e9fe5a59..10f5a39f 100644 --- a/src/entrypoints/groundstation/assets/styles/white-mode.qss +++ b/src/entrypoints/groundstation/assets/styles/white-mode.qss @@ -1058,3 +1058,29 @@ QSplitter[orientation="2"]::handle { border-top: 2px dashed #606060; max-height: 0px; } + + +QListWidget { + show-decoration-selected: 1; + color: black; + border: none; + font-weight: bold; + font-size: 16px; +} + +QListWidget::item { + background-color: #f2f2f2; + padding-top: 0; + padding-bottom: 0; + padding-left: 10px; + padding-right: 10px; +} + +QListWidget::item:selected { + color: black; + border-width: 0; + border-top-style: solid; + border-top-width: 5px; + border-top-color: #f2f2f2; + background-color: #b3b3b3; +} \ No newline at end of file diff --git a/src/shared/Modules/Tabs/TabsModule.cpp b/src/shared/Modules/Tabs/TabsModule.cpp index 53d3c3c2..87bb7526 100644 --- a/src/shared/Modules/Tabs/TabsModule.cpp +++ b/src/shared/Modules/Tabs/TabsModule.cpp @@ -215,39 +215,11 @@ void TabsModule::onMenuRenameTabClick() // ---- UI -constexpr const char* componentsStyleSheet = R"x( - QListWidget { - show-decoration-selected: 1; - color: #d7d6d6; - border: none; - font-weight: bold; - font-size: 16px; - } - - QListWidget::item { - background-color: #494949; - padding-top: 0; - padding-bottom: 0; - padding-left: 10px; - padding-right: 10px; - } - - QListWidget::item:selected { - color: #d7d6d6; - border-width: 0; - border-top-style: solid; - border-top-width: 5px; - border-top-color: #a8a8a9; - background-color: #606060; - } -)x"; - void TabsModule::setupUi() { // Top component (top bar) tabNames = new QListWidget; tabNames->setFlow(QListView::Flow::LeftToRight); - tabNames->setStyleSheet(componentsStyleSheet); tabNames->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); tabNames->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents); tabNames->setSelectionMode(QAbstractItemView::SingleSelection); @@ -256,7 +228,6 @@ void TabsModule::setupUi() // Bottom component tabContents = new QStackedWidget; tabContents->setObjectName("TabsStackedWidget"); - tabContents->setStyleSheet(componentsStyleSheet); // Putting all together QBoxLayout* outerLayout = new QBoxLayout(QBoxLayout::TopToBottom, this); -- GitLab