App: Move the -style check into windows-specific code

Creates warning about unused variable on Linux.

Amends 3babe8c73.

Change-Id: I038502afc7e488354da7c871520c39a08ec54aa6
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
hjk
2024-07-25 10:00:20 +02:00
parent 98c55d979b
commit c811b93ece

View File

@@ -534,10 +534,6 @@ int main(int argc, char **argv)
Options options = parseCommandLine(argc, argv); Options options = parseCommandLine(argc, argv);
applicationDirPath(argv[0]); 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")) { if (qEnvironmentVariableIsSet("QTC_DO_NOT_PROPAGATE_LD_PRELOAD")) {
Utils::Environment::modifySystemEnvironment( Utils::Environment::modifySystemEnvironment(
{{"LD_PRELOAD", "", Utils::EnvironmentItem::Unset}}); {{"LD_PRELOAD", "", Utils::EnvironmentItem::Unset}});
@@ -680,7 +676,11 @@ int main(int argc, char **argv)
setPixmapCacheLimit(); setPixmapCacheLimit();
loadFonts(); loadFonts();
if (Utils::HostOsInfo::isWindowsHost() && !hasStyleOption) { if (Utils::HostOsInfo::isWindowsHost()) {
const bool hasStyleOption = Utils::findOrDefault(options.appArguments, [](char *arg) {
return strcmp(arg, "-style") == 0;
});
if (!hasStyleOption) {
// The Windows 11 default style (Qt 6.7) has major issues, therefore // The Windows 11 default style (Qt 6.7) has major issues, therefore
// set the previous default style: "windowsvista" // set the previous default style: "windowsvista"
// FIXME: check newer Qt Versions // FIXME: check newer Qt Versions
@@ -692,6 +692,7 @@ int main(int argc, char **argv)
if (fractionalDpi) if (fractionalDpi)
QApplication::setStyle(QLatin1String("fusion")); QApplication::setStyle(QLatin1String("fusion"));
} }
}
const int threadCount = QThreadPool::globalInstance()->maxThreadCount(); const int threadCount = QThreadPool::globalInstance()->maxThreadCount();
QThreadPool::globalInstance()->setMaxThreadCount(qMax(4, 2 * threadCount)); QThreadPool::globalInstance()->setMaxThreadCount(qMax(4, 2 * threadCount));