aboutsummaryrefslogtreecommitdiffstats
path: root/src/app
diff options
context:
space:
mode:
authorCristian Adam <cristian.adam@qt.io>2023-06-14 14:20:19 +0200
committerCristian Adam <cristian.adam@qt.io>2023-06-16 10:36:58 +0000
commitdb8842a0d480d36b568336889a06e623f0c1685e (patch)
tree1cf7e8a7498615a53eb3f7fef85b1e47f4de0069 /src/app
parent118c493c6c58e445f259d0899a7c435b22ba1210 (diff)
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>
Diffstat (limited to 'src/app')
-rw-r--r--src/app/main.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/app/main.cpp b/src/app/main.cpp
index 9e1e745880..08d45e3544 100644
--- a/src/app/main.cpp
+++ b/src/app/main.cpp
@@ -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();