mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-06 05:01:25 -07:00
Fix screen scaling factor calculation
For some users on Windows the physicalDotsPerInch() could return values that are smaller than the normal 96 DPI which leads to big dialog sizes taking the entire screen. So we need to ensure it is at least 96 DPI. Closes #11405, #11407.
This commit is contained in:
parent
7825d8627f
commit
b5ee908f6c
1 changed files with 4 additions and 1 deletions
|
@ -52,7 +52,10 @@ qreal Utils::Gui::screenScalingFactor(const QWidget *widget)
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
const int screenNumber = qApp->desktop()->screenNumber(widget);
|
const int screenNumber = qApp->desktop()->screenNumber(widget);
|
||||||
const QScreen *screen = QApplication::screens()[screenNumber];
|
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)
|
#elif defined(Q_OS_MAC)
|
||||||
return 1;
|
return 1;
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue