1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-11 07:18:08 +00:00

Merge pull request #11409 from Chocobo1/dpi

Fix screen scaling factor calculation
This commit is contained in:
Mike Tzou 2019-10-29 09:56:17 +08:00 committed by GitHub
commit c73d698718
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -68,7 +68,10 @@ qreal Utils::Gui::screenScalingFactor(const QWidget *widget)
#ifdef Q_OS_WIN
const int screenNumber = qApp->desktop()->screenNumber(widget);
const QScreen *screen = QApplication::screens()[screenNumber];
return (screen->logicalDotsPerInch() / screen->physicalDotsPerInch());
// Workaround for QScreen::physicalDotsPerInch() that could return
// values that are smaller than the normal 96 DPI on Windows
const qreal physicalDPI = qMax<qreal>(screen->physicalDotsPerInch(), 96);
return (screen->logicalDotsPerInch() / physicalDPI);
#elif defined(Q_OS_MACOS)
return 1;
#else