1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 15:29:55 +00:00

Merge branch 'style_change' into 'master'

Minor changes in Qt styles handling

See merge request OpenMW/openmw!4093
This commit is contained in:
psi29a 2024-05-14 07:43:55 +00:00
commit 2bed7450b6
9 changed files with 50 additions and 17 deletions

View file

@ -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::PaletteChange)
{
if (toolBar != nullptr)
toolBar->setStyleSheet(toolBarStyle);
}
return QMainWindow::event(event);
}
void Launcher::MainDialog::createIcons()
{
if (!QIcon::hasThemeIcon("document-new"))

View file

@ -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);

View file

@ -75,16 +75,6 @@
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="styleSheet">
<string notr="true">QToolBar {
border: 0px;
}
QToolButton {
min-width: 70px;
}
</string>
</property>
<property name="movable">
<bool>false</bool>
</property>

View file

@ -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);

View file

@ -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

View file

@ -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::PaletteChange)
{
if (mStatusBar != nullptr)
mStatusBar->setStyleSheet(statusBarStyle);
}
return QWidget::event(event);
}
void CSVWorld::TableBottomBox::setEditLock(bool locked)
{
if (mCreator)

View file

@ -61,6 +61,9 @@ namespace CSVWorld
void extendedConfigRequest(ExtendedCommandConfigurator::Mode mode, const std::vector<std::string>& selectedIds);
protected:
bool event(QEvent* event) override;
public:
TableBottomBox(const CreatorFactoryBase& creatorFactory, CSMDoc::Document& document,
const CSMWorld::UniversalId& id, QWidget* parent = nullptr);

View file

@ -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);

View file

@ -22,9 +22,6 @@
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QRadioButton" name="retailDiscRadioButton">
<property name="styleSheet">
<string notr="true">font-weight:bold;</string>
</property>
<property name="text">
<string>Retail CD/DVD</string>
</property>
@ -81,9 +78,6 @@
</item>
<item>
<widget class="QRadioButton" name="existingLocationRadioButton">
<property name="styleSheet">
<string notr="true">font-weight:bold</string>
</property>
<property name="text">
<string>Existing Installation</string>
</property>