diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-04-23 08:00:15 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-05-26 20:04:40 +0200 |
commit | bdcb1414647207cf92921431cfe49491bd06c439 (patch) | |
tree | da60bb5062f785dff5c89229472f04dd6b20eb07 /src/plugins | |
parent | ec3ba7209e624873da83ed8785eb4822ce0be2f7 (diff) |
Windows: Fix wrong default font sizes after changing scaling
Use the ForDpi versions of retrieving non clientMetrics.
Pick-to: 5.15
Task-number: QTBUG-82267
Change-Id: I434f6980c47258bfe40d38723d3f66d71217e186
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/platforms/windows/qwindowstheme.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/plugins/platforms/windows/qwindowstheme.cpp b/src/plugins/platforms/windows/qwindowstheme.cpp index 7f47cd712f..25e083fd5c 100644 --- a/src/plugins/platforms/windows/qwindowstheme.cpp +++ b/src/plugins/platforms/windows/qwindowstheme.cpp @@ -51,6 +51,7 @@ #if QT_CONFIG(systemtrayicon) # include "qwindowssystemtrayicon.h" #endif +#include "qwindowsscreen.h" #include "qt_windows.h" #include <commctrl.h> #include <objbase.h> @@ -564,13 +565,32 @@ void QWindowsTheme::refresh() refreshFonts(); } +#ifndef QT_NO_DEBUG_STREAM +QDebug operator<<(QDebug d, const LOGFONT &lf); // in platformsupport + +QDebug operator<<(QDebug d, const NONCLIENTMETRICS &m) +{ + QDebugStateSaver saver(d); + d.nospace(); + d.noquote(); + d << "NONCLIENTMETRICS(iMenu=" << m.iMenuWidth << 'x' << m.iMenuHeight + << ", lfCaptionFont=" << m.lfCaptionFont << ", lfSmCaptionFont=" + << m.lfSmCaptionFont << ", lfMenuFont=" << m.lfMenuFont + << ", lfMessageFont=" << m.lfMessageFont << ", lfStatusFont=" + << m.lfStatusFont << ')'; + return d; +} +#endif // QT_NO_DEBUG_STREAM + void QWindowsTheme::refreshFonts() { clearFonts(); if (!QGuiApplication::desktopSettingsAware()) return; NONCLIENTMETRICS ncm; - QWindowsContext::nonClientMetrics(&ncm); + auto screenManager = QWindowsContext::instance()->screenManager(); + QWindowsContext::nonClientMetricsForScreen(&ncm, screenManager.screens().value(0)); + qCDebug(lcQpaWindows) << __FUNCTION__ << ncm; const QFont menuFont = QWindowsFontDatabase::LOGFONT_to_QFont(ncm.lfMenuFont); const QFont messageBoxFont = QWindowsFontDatabase::LOGFONT_to_QFont(ncm.lfMessageFont); const QFont statusFont = QWindowsFontDatabase::LOGFONT_to_QFont(ncm.lfStatusFont); |