From d603ee689f0e3fdcfa3230b3d75cdce6c5af05c1 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 4 Apr 2019 13:53:19 +0200 Subject: Widget style: Use per-screen DPI in QStyleHelper::dpiScaled() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pass the style option to dpiScaled() in order to get the correct screen DPI. The style option contains the font, which again contains the current DPI value. Add QFontMetrics::fontDpi() accessors to get the DPI from the QFont. This DPI will/should be updated on screen change. Replace hardcoded Q_OS_MAC DPI with hardcoded base DPI. This makes per-screen DPI testable on macOS, too. Task-number: QTBUG-45055 Change-Id: I75f8b37d45eb50c3334b46b8469a546d29712f1b Reviewed-by: Morten Johan Sørvig --- src/widgets/dialogs/qwizard.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/widgets/dialogs/qwizard.cpp') diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp index 40db586f0e..7558054da5 100644 --- a/src/widgets/dialogs/qwizard.cpp +++ b/src/widgets/dialogs/qwizard.cpp @@ -1336,7 +1336,7 @@ void QWizardPrivate::updateMinMaxSizes(const QWizardLayoutInfo &info) int extraHeight = 0; #if QT_CONFIG(style_windowsvista) if (isVistaThemeEnabled()) - extraHeight = vistaHelper->titleBarSize() + vistaHelper->topOffset(); + extraHeight = vistaHelper->titleBarSize() + vistaHelper->topOffset(q); #endif QSize minimumSize = mainLayout->totalMinimumSize() + QSize(0, extraHeight); QSize maximumSize = mainLayout->totalMaximumSize(); @@ -1595,8 +1595,8 @@ bool QWizardPrivate::handleAeroStyleChange() bool vistaMargins = false; if (isVistaThemeEnabled()) { - const int topOffset = vistaHelper->topOffset(); - const int topPadding = vistaHelper->topPadding(); + const int topOffset = vistaHelper->topOffset(q); + const int topPadding = vistaHelper->topPadding(q); if (isVistaThemeEnabled(QVistaHelper::VistaAero)) { if (isWindow) { vistaHelper->setDWMTitleBar(QVistaHelper::ExtendedTitleBar); @@ -3214,7 +3214,7 @@ void QWizard::resizeEvent(QResizeEvent *event) int heightOffset = 0; #if QT_CONFIG(style_windowsvista) if (d->isVistaThemeEnabled()) { - heightOffset = d->vistaHelper->topOffset(); + heightOffset = d->vistaHelper->topOffset(this); if (d->isVistaThemeEnabled(QVistaHelper::VistaAero)) heightOffset += d->vistaHelper->titleBarSize(); } @@ -3246,7 +3246,7 @@ void QWizard::paintEvent(QPaintEvent * event) if (d->isVistaThemeEnabled(QVistaHelper::VistaBasic)) { QPainter painter(this); QColor color = d->vistaHelper->basicWindowFrameColor(); - painter.fillRect(0, 0, width(), QVistaHelper::topOffset(), color); + painter.fillRect(0, 0, width(), QVistaHelper::topOffset(this), color); } d->vistaHelper->paintEvent(event); } -- cgit v1.2.3