App: Use 'fusion' style only on fractional dpi on Windows

On 200% on 4k screens there is no reason to use the 'fusion' style since
the 'vista' native one works perfectly fine.

Task-number: QTCREATORBUG-16095
Change-Id: I1ffd02891aa5ef30c0172edd949d63d4270400c4
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
Cristian Adam
2024-04-10 18:41:14 +02:00
parent 70dba4977f
commit 6656204b1e

View File

@@ -679,10 +679,12 @@ int main(int argc, char **argv)
setPixmapCacheLimit();
loadFonts();
if (Utils::HostOsInfo::isWindowsHost() && !qFuzzyCompare(qApp->devicePixelRatio(), 1.0)
&& !hasStyleOption) {
// On 100% or 200% scaling we can use the default 'Vista' style on Windows
qreal tmp;
const bool fractionalDpi = !qFuzzyIsNull(std::modf(qApp->devicePixelRatio(), &tmp));
if (Utils::HostOsInfo::isWindowsHost() && fractionalDpi && !hasStyleOption)
QApplication::setStyle(QLatin1String("fusion"));
}
const int threadCount = QThreadPool::globalInstance()->maxThreadCount();
QThreadPool::globalInstance()->setMaxThreadCount(qMax(4, 2 * threadCount));