Gui: Add QtStyle user parameter

This allows theme developers to set proper Qt style.
This commit is contained in:
Kacper Donat
2024-06-02 17:02:39 +02:00
committed by Chris Hennes
parent 433dcec0be
commit 62463fa0bd
3 changed files with 12 additions and 1 deletions

View File

@@ -251,6 +251,9 @@ void DlgSettingsGeneral::saveSettings()
int blinkTime{hGrp->GetBool("EnableCursorBlinking", true) ? -1 : 0};
qApp->setCursorFlashTime(blinkTime);
std::string qtStyle = hGrp->GetASCII("QtStyle");
qApp->setStyle(QString::fromStdString(qtStyle));
saveDockWindowVisibility();
hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/MainWindow");

View File

@@ -229,6 +229,7 @@ void StartupPostProcess::execute()
setWheelEventFilter();
setLocale();
setCursorFlashing();
setQtStyle();
checkOpenGL();
loadOpenInventor();
setBranding();
@@ -296,7 +297,6 @@ void StartupPostProcess::setLocale()
else if (localeFormat == 2) {
Translator::instance()->setLocale("C");
}
}
void StartupPostProcess::setCursorFlashing()
@@ -307,6 +307,13 @@ void StartupPostProcess::setCursorFlashing()
QApplication::setCursorFlashTime(blinkTime);
}
void StartupPostProcess::setQtStyle()
{
ParameterGrp::handle hGrp = WindowParameter::getDefaultParameter()->GetGroup("General");
auto qtStyle = hGrp->GetASCII("QtStyle");
QApplication::setStyle(QString::fromStdString(qtStyle));
}
void StartupPostProcess::checkOpenGL()
{
QWindow window;

View File

@@ -65,6 +65,7 @@ private:
void setWheelEventFilter();
void setLocale();
void setCursorFlashing();
void setQtStyle();
void checkOpenGL();
void loadOpenInventor();
void setBranding();