mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-14 10:37:06 -07:00
Merge pull request #11417 from Chocobo1/dpi_v41x
Fix screen scaling factor calculation (backport to v4_1_x)
This commit is contained in:
commit
102b7fa78e
1 changed files with 4 additions and 1 deletions
|
@ -52,7 +52,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_MAC)
|
||||
return 1;
|
||||
#else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue