Gui: Fix order of stylesheet applying
This commit is contained in:
committed by
Chris Hennes
parent
08aeb5d65b
commit
a09de19764
@@ -406,11 +406,6 @@ void DlgSettingsGeneral::saveThemes()
|
||||
}
|
||||
}
|
||||
|
||||
// Set the StyleSheet
|
||||
QString sheet = QString::fromStdString(hGrp->GetASCII("StyleSheet"));
|
||||
bool tiledBackground = hGrp->GetBool("TiledBackground", false);
|
||||
Application::Instance->setStyleSheet(sheet, tiledBackground);
|
||||
|
||||
themeChanged = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -205,32 +205,5 @@ void DlgSettingsUI::changeEvent(QEvent *e)
|
||||
}
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
void applyStyleSheet(ParameterGrp *hGrp)
|
||||
{
|
||||
if (auto parameterManager = Base::provideService<Gui::StyleParameters::ParameterManager>()) {
|
||||
parameterManager->reload();
|
||||
}
|
||||
|
||||
auto sheet = hGrp->GetASCII("StyleSheet");
|
||||
bool tiledBG = hGrp->GetBool("TiledBackground", false);
|
||||
Gui::Application::Instance->setStyleSheet(QString::fromUtf8(sheet.c_str()), tiledBG);
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
void DlgSettingsUI::attachObserver()
|
||||
{
|
||||
static ParamHandlers handlers;
|
||||
|
||||
auto handler = handlers.addDelayedHandler("BaseApp/Preferences/MainWindow",
|
||||
{"StyleSheet", "TiledBackground"},
|
||||
applyStyleSheet);
|
||||
handlers.addHandler("BaseApp/Preferences/Themes",
|
||||
{"ThemeAccentColor1", "ThemeAccentColor2", "ThemeAccentColor2"},
|
||||
handler);
|
||||
}
|
||||
|
||||
#include "moc_DlgSettingsUI.cpp"
|
||||
|
||||
|
||||
@@ -51,8 +51,6 @@ public:
|
||||
|
||||
void loadStyleSheet();
|
||||
|
||||
static void attachObserver();
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *e) override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user