win: resolve theme fonts at 96 dpi
This code became out of sync with the changes to the
LOGFONT_to_QFont() implementation introduced in edb00660
.
After that, LOGFONT_to_QFont() on longer adjusts the font size
according to the DPI for the primary display. This means that
the the code should also not get font metrics from the first
display, but instead get metrics at 96 DPI.
Fixes: QTBUG-105857
Pick-to: 6.4 6.2
Change-Id: I5974a77593e1944d889a45a352923fb9aa9a0dec
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
parent
2991c66b75
commit
64bb83f882
@ -637,20 +637,22 @@ void QWindowsTheme::refreshFonts()
|
||||
clearFonts();
|
||||
if (!QGuiApplication::desktopSettingsAware())
|
||||
return;
|
||||
|
||||
const int dpi = 96;
|
||||
NONCLIENTMETRICS ncm;
|
||||
auto &screenManager = QWindowsContext::instance()->screenManager();
|
||||
QWindowsContext::nonClientMetricsForScreen(&ncm, screenManager.screens().value(0));
|
||||
QWindowsContext::nonClientMetrics(&ncm, dpi);
|
||||
qCDebug(lcQpaWindow) << __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);
|
||||
const QFont titleFont = QWindowsFontDatabase::LOGFONT_to_QFont(ncm.lfCaptionFont);
|
||||
|
||||
const QFont menuFont = QWindowsFontDatabase::LOGFONT_to_QFont(ncm.lfMenuFont, dpi);
|
||||
const QFont messageBoxFont = QWindowsFontDatabase::LOGFONT_to_QFont(ncm.lfMessageFont, dpi);
|
||||
const QFont statusFont = QWindowsFontDatabase::LOGFONT_to_QFont(ncm.lfStatusFont, dpi);
|
||||
const QFont titleFont = QWindowsFontDatabase::LOGFONT_to_QFont(ncm.lfCaptionFont, dpi);
|
||||
QFont fixedFont(QStringLiteral("Courier New"), messageBoxFont.pointSize());
|
||||
fixedFont.setStyleHint(QFont::TypeWriter);
|
||||
|
||||
LOGFONT lfIconTitleFont;
|
||||
SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(lfIconTitleFont), &lfIconTitleFont, 0);
|
||||
const QFont iconTitleFont = QWindowsFontDatabase::LOGFONT_to_QFont(lfIconTitleFont);
|
||||
SystemParametersInfoForDpi(SPI_GETICONTITLELOGFONT, sizeof(lfIconTitleFont), &lfIconTitleFont, 0, dpi);
|
||||
const QFont iconTitleFont = QWindowsFontDatabase::LOGFONT_to_QFont(lfIconTitleFont, dpi);
|
||||
|
||||
m_fonts[SystemFont] = new QFont(QWindowsFontDatabase::systemDefaultFont());
|
||||
m_fonts[MenuFont] = new QFont(menuFont);
|
||||
|
Loading…
Reference in New Issue
Block a user