[Gui] Make styles update on paint (#17376)

* [Gui] Make styles update on paint

Fixes #15756. Similar implementation to that already in FileCardDelegate.cpp

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Benjamin Bræstrup Sayoc
2024-10-28 16:48:47 +01:00
committed by GitHub
parent 1cf5b23927
commit 954bae725e
6 changed files with 40 additions and 38 deletions

View File

@@ -230,18 +230,6 @@ void StartView::configureNewFileButtons(QLayout* layout) const
tr("Create an architectural project"),
QLatin1String(":/icons/BIMWorkbench.svg")});
auto hGrp = App::GetApplication().GetParameterGroupByPath(
"User parameter:BaseApp/Preferences/Mod/Start");
if (hGrp->GetBool("FileCardUseStyleSheet", true)) {
QString style = fileCardStyle();
newEmptyFile->setStyleSheet(style);
openFile->setStyleSheet(style);
partDesign->setStyleSheet(style);
assembly->setStyleSheet(style);
draft->setStyleSheet(style);
arch->setStyleSheet(style);
}
// TODO: Ensure all of the required WBs are actually available
layout->addWidget(partDesign);
layout->addWidget(assembly);
@@ -258,6 +246,17 @@ void StartView::configureNewFileButtons(QLayout* layout) const
connect(arch, &QPushButton::clicked, this, &StartView::newArchFile);
}
void StartView::paintEvent(QPaintEvent* event)
{
QString style = QStringLiteral("");
if (qApp->styleSheet().isEmpty()) {
style = fileCardStyle();
}
setStyleSheet(style);
Gui::MDIView::paintEvent(event);
}
QString StartView::fileCardStyle() const
{
if (!qApp->styleSheet().isEmpty()) {