From abd4596cf8fbc60fefb8670574a9f4b6f16b5597 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sun, 12 May 2024 11:45:02 +0400 Subject: [PATCH 1/6] Do not use style sheets to set font --- apps/wizard/methodselectionpage.cpp | 5 +++++ apps/wizard/ui/methodselectionpage.ui | 6 ------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/apps/wizard/methodselectionpage.cpp b/apps/wizard/methodselectionpage.cpp index 1c80608a17..4447cb60f7 100644 --- a/apps/wizard/methodselectionpage.cpp +++ b/apps/wizard/methodselectionpage.cpp @@ -23,6 +23,11 @@ Wizard::MethodSelectionPage::MethodSelectionPage(QWidget* parent) buyLinkButton->released(); #endif + QFont font = existingLocationRadioButton->font(); + font.setBold(true); + existingLocationRadioButton->setFont(font); + retailDiscRadioButton->setFont(font); + registerField(QLatin1String("installation.retailDisc"), retailDiscRadioButton); connect(buyLinkButton, &QPushButton::released, this, &MethodSelectionPage::handleBuyButton); diff --git a/apps/wizard/ui/methodselectionpage.ui b/apps/wizard/ui/methodselectionpage.ui index ed6f91159d..61bf81433f 100644 --- a/apps/wizard/ui/methodselectionpage.ui +++ b/apps/wizard/ui/methodselectionpage.ui @@ -22,9 +22,6 @@ - - font-weight:bold; - Retail CD/DVD @@ -81,9 +78,6 @@ - - font-weight:bold - Existing Installation From e7d566eb2ebb204fbf055808ea963d288fa23ee8 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sun, 12 May 2024 11:53:17 +0400 Subject: [PATCH 2/6] 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); From b0930158df43bc9eabc15df9ba42db58189ffba0 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sun, 12 May 2024 11:56:04 +0400 Subject: [PATCH 3/6] Use an auto raise mode to disable the border --- apps/launcher/utils/lineedit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/launcher/utils/lineedit.cpp b/apps/launcher/utils/lineedit.cpp index 0741e84c12..ad3f82ec30 100644 --- a/apps/launcher/utils/lineedit.cpp +++ b/apps/launcher/utils/lineedit.cpp @@ -11,7 +11,7 @@ void LineEdit::setupClearButton() mClearButton = new QToolButton(this); mClearButton->setIcon(QIcon::fromTheme("edit-clear")); mClearButton->setCursor(Qt::ArrowCursor); - mClearButton->setStyleSheet("QToolButton { border: none; padding: 0px; }"); + mClearButton->setAutoRaise(true); mClearButton->hide(); connect(mClearButton, &QToolButton::clicked, this, &LineEdit::clear); connect(this, &LineEdit::textChanged, this, &LineEdit::updateClearButton); From d5bbd7582865789cc6b724c73cfa8ff9a2ff6d0d Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sun, 12 May 2024 12:31:00 +0400 Subject: [PATCH 4/6] Make sure that Open button becomes focused after enabling --- apps/opencs/view/doc/filedialog.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/opencs/view/doc/filedialog.cpp b/apps/opencs/view/doc/filedialog.cpp index 1b502c9d6c..7040c359e2 100644 --- a/apps/opencs/view/doc/filedialog.cpp +++ b/apps/opencs/view/doc/filedialog.cpp @@ -177,6 +177,8 @@ void CSVDoc::FileDialog::slotUpdateAcceptButton(const QString& name, bool) mAdjusterWidget->setName("", true); ui.projectButtonBox->button(QDialogButtonBox::Ok)->setEnabled(success); + if (success) + ui.projectButtonBox->button(QDialogButtonBox::Ok)->setFocus(); } QString CSVDoc::FileDialog::filename() const From 0262b33067ae4edc8195d51ad8ce1d99672d9804 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sun, 12 May 2024 12:40:19 +0400 Subject: [PATCH 5/6] Update toolbar style sheet when theme changed --- apps/launcher/maindialog.cpp | 18 ++++++++++++++++++ apps/launcher/maindialog.hpp | 3 +++ apps/launcher/ui/mainwindow.ui | 10 ---------- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/apps/launcher/maindialog.cpp b/apps/launcher/maindialog.cpp index df4c6fb22d..03667aaa26 100644 --- a/apps/launcher/maindialog.cpp +++ b/apps/launcher/maindialog.cpp @@ -22,6 +22,11 @@ #include "importpage.hpp" #include "settingspage.hpp" +namespace +{ + constexpr const char* toolBarStyle = "QToolBar { border: 0px; } QToolButton { min-width: 70px }"; +} + using namespace Process; void cfgError(const QString& title, const QString& msg) @@ -73,6 +78,7 @@ Launcher::MainDialog::MainDialog(const Files::ConfigurationManager& configuratio QLabel* logo = new QLabel(this); logo->setPixmap(QIcon(":/images/openmw-header.png").pixmap(QSize(294, 64))); toolBar->addWidget(logo); + toolBar->setStyleSheet(toolBarStyle); } Launcher::MainDialog::~MainDialog() @@ -81,6 +87,18 @@ Launcher::MainDialog::~MainDialog() delete mWizardInvoker; } +bool Launcher::MainDialog::event(QEvent* event) +{ + // Apply style sheet again if style was changed + if (event->type() == QEvent::ThemeChange || event->type() == QEvent::PaletteChange) + { + if (toolBar != nullptr) + toolBar->setStyleSheet(toolBarStyle); + } + + return QMainWindow::event(event); +} + void Launcher::MainDialog::createIcons() { if (!QIcon::hasThemeIcon("document-new")) diff --git a/apps/launcher/maindialog.hpp b/apps/launcher/maindialog.hpp index cc68d52c77..5ceee966ba 100644 --- a/apps/launcher/maindialog.hpp +++ b/apps/launcher/maindialog.hpp @@ -60,6 +60,9 @@ namespace Launcher void play(); void help(); + protected: + bool event(QEvent* event) override; + private slots: void wizardStarted(); void wizardFinished(int exitCode, QProcess::ExitStatus exitStatus); diff --git a/apps/launcher/ui/mainwindow.ui b/apps/launcher/ui/mainwindow.ui index 6a2502f466..b5ee65d17c 100644 --- a/apps/launcher/ui/mainwindow.ui +++ b/apps/launcher/ui/mainwindow.ui @@ -75,16 +75,6 @@ Qt::LeftToRight - - QToolBar { - border: 0px; -} - -QToolButton { - min-width: 70px; -} - - false From bf568da6de49c0a0eb4bad1aed550054cf8d2f35 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Sun, 12 May 2024 14:23:54 +0400 Subject: [PATCH 6/6] Remove redundant checks --- apps/launcher/maindialog.cpp | 2 +- apps/opencs/view/world/tablebottombox.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/launcher/maindialog.cpp b/apps/launcher/maindialog.cpp index 03667aaa26..71bda1c1ef 100644 --- a/apps/launcher/maindialog.cpp +++ b/apps/launcher/maindialog.cpp @@ -90,7 +90,7 @@ Launcher::MainDialog::~MainDialog() bool Launcher::MainDialog::event(QEvent* event) { // Apply style sheet again if style was changed - if (event->type() == QEvent::ThemeChange || event->type() == QEvent::PaletteChange) + if (event->type() == QEvent::PaletteChange) { if (toolBar != nullptr) toolBar->setStyleSheet(toolBarStyle); diff --git a/apps/opencs/view/world/tablebottombox.cpp b/apps/opencs/view/world/tablebottombox.cpp index 75fdee3461..396ba2de33 100644 --- a/apps/opencs/view/world/tablebottombox.cpp +++ b/apps/opencs/view/world/tablebottombox.cpp @@ -138,7 +138,7 @@ CSVWorld::TableBottomBox::TableBottomBox(const CreatorFactoryBase& creatorFactor bool CSVWorld::TableBottomBox::event(QEvent* event) { // Apply style sheet again if style was changed - if (event->type() == QEvent::ThemeChange || event->type() == QEvent::PaletteChange) + if (event->type() == QEvent::PaletteChange) { if (mStatusBar != nullptr) mStatusBar->setStyleSheet(statusBarStyle);