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);
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}});
@@ -680,17 +676,22 @@ int main(int argc, char **argv)
setPixmapCacheLimit();
loadFonts();
if (Utils::HostOsInfo::isWindowsHost() && !hasStyleOption) {
// The Windows 11 default style (Qt 6.7) has major issues, therefore
// set the previous default style: "windowsvista"
// FIXME: check newer Qt Versions
QApplication::setStyle(QLatin1String("windowsvista"));
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
// set the previous default style: "windowsvista"
// FIXME: check newer Qt Versions
QApplication::setStyle(QLatin1String("windowsvista"));
// On scaling different than 100% or 200% use the "fusion" style
qreal tmp;
const bool fractionalDpi = !qFuzzyIsNull(std::modf(qApp->devicePixelRatio(), &tmp));
if (fractionalDpi)
QApplication::setStyle(QLatin1String("fusion"));
// On scaling different than 100% or 200% use the "fusion" style
qreal tmp;
const bool fractionalDpi = !qFuzzyIsNull(std::modf(qApp->devicePixelRatio(), &tmp));
if (fractionalDpi)
QApplication::setStyle(QLatin1String("fusion"));
}
}
const int threadCount = QThreadPool::globalInstance()->maxThreadCount();