App: Allow usage of "windows" style if enforced

Currently the code checks if qFuzzyCompare(qApp->devicePixelRatio(),
1.0) and if the condition is true it will always set the "fusion" style.

If the user sets a "-style" option we shouldn't override it.

Change-Id: If9a20a1b38f4a5aa3c2ccaf53cb01aafb45077f9
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Cristian Adam
2023-06-14 14:20:19 +02:00
parent 118c493c6c
commit db8842a0d4

View File

@@ -495,6 +495,10 @@ int main(int argc, char **argv)
Options options = parseCommandLine(argc, argv);
applicationDirPath(argv[0]);
const bool hasStyleOption = Utils::findOrDefault(options.appArguments, [](char *arg) {
return strcmp(arg, "-style") == 0;
});
if (qEnvironmentVariableIsSet("QTC_DO_NOT_PROPAGATE_LD_PRELOAD")) {
Utils::Environment::modifySystemEnvironment(
{{"LD_PRELOAD", "", Utils::EnvironmentItem::Unset}});
@@ -607,10 +611,8 @@ int main(int argc, char **argv)
setPixmapCacheLimit();
loadFonts();
if (Utils::HostOsInfo::isWindowsHost()
&& !qFuzzyCompare(qApp->devicePixelRatio(), 1.0)
&& QApplication::style()->objectName().startsWith(
QLatin1String("windows"), Qt::CaseInsensitive)) {
if (Utils::HostOsInfo::isWindowsHost() && !qFuzzyCompare(qApp->devicePixelRatio(), 1.0)
&& !hasStyleOption) {
QApplication::setStyle(QLatin1String("fusion"));
}
const int threadCount = QThreadPool::globalInstance()->maxThreadCount();