From e7d566eb2ebb204fbf055808ea963d288fa23ee8 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sun, 12 May 2024 11:53:17 +0400 Subject: [PATCH] Remove border from status bar --- apps/opencs/view/world/tablebottombox.cpp | 18 ++++++++++++++++++ apps/opencs/view/world/tablebottombox.hpp | 3 +++ 2 files changed, 21 insertions(+) diff --git a/apps/opencs/view/world/tablebottombox.cpp b/apps/opencs/view/world/tablebottombox.cpp index 72b70b8109..75fdee3461 100644 --- a/apps/opencs/view/world/tablebottombox.cpp +++ b/apps/opencs/view/world/tablebottombox.cpp @@ -15,6 +15,11 @@ #include "creator.hpp" #include "infocreator.hpp" +namespace +{ + constexpr const char* statusBarStyle = "QStatusBar::item { border: 0px }"; +} + void CSVWorld::TableBottomBox::updateSize() { // Make sure that the size of the bottom box is determined by the currently visible widget @@ -104,6 +109,7 @@ CSVWorld::TableBottomBox::TableBottomBox(const CreatorFactoryBase& creatorFactor mStatusBar = new QStatusBar(this); mStatusBar->addWidget(mStatus); + mStatusBar->setStyleSheet(statusBarStyle); mLayout->addWidget(mStatusBar); @@ -129,6 +135,18 @@ CSVWorld::TableBottomBox::TableBottomBox(const CreatorFactoryBase& creatorFactor updateSize(); } +bool CSVWorld::TableBottomBox::event(QEvent* event) +{ + // Apply style sheet again if style was changed + if (event->type() == QEvent::ThemeChange || event->type() == QEvent::PaletteChange) + { + if (mStatusBar != nullptr) + mStatusBar->setStyleSheet(statusBarStyle); + } + + return QWidget::event(event); +} + void CSVWorld::TableBottomBox::setEditLock(bool locked) { if (mCreator) diff --git a/apps/opencs/view/world/tablebottombox.hpp b/apps/opencs/view/world/tablebottombox.hpp index 7be57066f6..193ca33026 100644 --- a/apps/opencs/view/world/tablebottombox.hpp +++ b/apps/opencs/view/world/tablebottombox.hpp @@ -61,6 +61,9 @@ namespace CSVWorld void extendedConfigRequest(ExtendedCommandConfigurator::Mode mode, const std::vector& selectedIds); + protected: + bool event(QEvent* event) override; + public: TableBottomBox(const CreatorFactoryBase& creatorFactory, CSMDoc::Document& document, const CSMWorld::UniversalId& id, QWidget* parent = nullptr);