Gui: Migrate to new styles
Since some time we have new stylesheets based on style parameters. For compatibility reasons however old stylesheets were left in the project - this commit removes them by reapplying the theme if old stylesheet is detected.
This commit is contained in:
committed by
Chris Hennes
parent
c5c937c8bd
commit
702aa21f6c
@@ -46,6 +46,7 @@
|
||||
#include <ranges>
|
||||
|
||||
#include "StartupProcess.h"
|
||||
#include "PreferencePackManager.h"
|
||||
#include "Application.h"
|
||||
#include "AutoSaver.h"
|
||||
#include "Dialogs/DlgCheckableMessageBox.h"
|
||||
@@ -333,6 +334,18 @@ void StartupPostProcess::setQtStyle()
|
||||
setStyleFromParameters();
|
||||
}
|
||||
|
||||
void StartupPostProcess::migrateOldTheme(const std::string& style)
|
||||
{
|
||||
auto prefPackManager = Application::Instance->prefPackManager();
|
||||
|
||||
if (style == "FreeCAD Light.qss") {
|
||||
prefPackManager->apply("FreeCAD Light");
|
||||
}
|
||||
else if (style == "FreeCAD Dark.qss") {
|
||||
prefPackManager->apply("FreeCAD Dark");
|
||||
}
|
||||
}
|
||||
|
||||
void StartupPostProcess::checkOpenGL()
|
||||
{
|
||||
QWindow window;
|
||||
@@ -536,7 +549,11 @@ void StartupPostProcess::setStyleSheet()
|
||||
}
|
||||
}
|
||||
|
||||
guiApp.setStyleSheet(QLatin1String(style.c_str()), hGrp->GetBool("TiledBackground", false));
|
||||
// In 1.1 we migrated to a common parametrized stylesheet.
|
||||
// if we detect an old style, we need to reapply the theme pack.
|
||||
migrateOldTheme(style);
|
||||
|
||||
guiApp.setStyleSheet(QString::fromStdString(style), hGrp->GetBool("TiledBackground", false));
|
||||
}
|
||||
|
||||
void StartupPostProcess::autoloadModules(const QStringList& wb)
|
||||
|
||||
Reference in New Issue
Block a user