forked from qt-creator/qt-creator
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:
@@ -495,6 +495,10 @@ 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}});
|
||||||
@@ -607,10 +611,8 @@ int main(int argc, char **argv)
|
|||||||
setPixmapCacheLimit();
|
setPixmapCacheLimit();
|
||||||
loadFonts();
|
loadFonts();
|
||||||
|
|
||||||
if (Utils::HostOsInfo::isWindowsHost()
|
if (Utils::HostOsInfo::isWindowsHost() && !qFuzzyCompare(qApp->devicePixelRatio(), 1.0)
|
||||||
&& !qFuzzyCompare(qApp->devicePixelRatio(), 1.0)
|
&& !hasStyleOption) {
|
||||||
&& QApplication::style()->objectName().startsWith(
|
|
||||||
QLatin1String("windows"), Qt::CaseInsensitive)) {
|
|
||||||
QApplication::setStyle(QLatin1String("fusion"));
|
QApplication::setStyle(QLatin1String("fusion"));
|
||||||
}
|
}
|
||||||
const int threadCount = QThreadPool::globalInstance()->maxThreadCount();
|
const int threadCount = QThreadPool::globalInstance()->maxThreadCount();
|
||||||
|
Reference in New Issue
Block a user