Browse Source

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.
adaptive-webui-19844
Chocobo1 5 years ago
parent
commit
4888b22622
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 5
      src/gui/utils.cpp

5
src/gui/utils.cpp

@ -68,7 +68,10 @@ qreal Utils::Gui::screenScalingFactor(const QWidget *widget) @@ -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

Loading…
Cancel
Save