diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-04-04 13:53:19 +0200 |
---|---|---|
committer | Morten Johan Sørvig <morten.sorvig@qt.io> | 2019-08-23 01:41:33 +0000 |
commit | d603ee689f0e3fdcfa3230b3d75cdce6c5af05c1 (patch) | |
tree | ffc037205f5bdad40adfca36abde8f7676832b3e /src/widgets/dialogs/qwizard_win_p.h | |
parent | f1e40dd6d6968c59885231f61f94787abd4cf783 (diff) |
Widget style: Use per-screen DPI in QStyleHelper::dpiScaled()
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 <morten.sorvig@qt.io>
Diffstat (limited to 'src/widgets/dialogs/qwizard_win_p.h')
-rw-r--r-- | src/widgets/dialogs/qwizard_win_p.h | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/widgets/dialogs/qwizard_win_p.h b/src/widgets/dialogs/qwizard_win_p.h index b3796e3f48..2469496b61 100644 --- a/src/widgets/dialogs/qwizard_win_p.h +++ b/src/widgets/dialogs/qwizard_win_p.h @@ -108,10 +108,10 @@ public: static VistaState vistaState(); static int titleBarSize() { return QVistaHelper::titleBarSizeDp() / QVistaHelper::m_devicePixelRatio; } static int titleBarSizeDp() { return QVistaHelper::frameSizeDp() + QVistaHelper::captionSizeDp(); } - static int topPadding() { // padding under text - return int(QStyleHelper::dpiScaled(4)); + static int topPadding(const QPaintDevice *device) { // padding under text + return int(QStyleHelper::dpiScaled(4, device)); } - static int topOffset(); + static int topOffset(const QPaintDevice *device); static HDC backingStoreDC(const QWidget *wizard, QPoint *offset); @@ -125,10 +125,12 @@ private: static int captionSize() { return QVistaHelper::captionSizeDp() / QVistaHelper::m_devicePixelRatio; } static int captionSizeDp(); - static int backButtonSize() { return int(QStyleHelper::dpiScaled(30)); } - static int iconSize(); - static int glowSize(); - int leftMargin() { return backButton_->isVisible() ? backButtonSize() + iconSpacing : 0; } + static int backButtonSize(const QPaintDevice *device) + { return int(QStyleHelper::dpiScaled(30, device)); } + static int iconSize(const QPaintDevice *device); + static int glowSize(const QPaintDevice *device); + int leftMargin(const QPaintDevice *device) + { return backButton_->isVisible() ? backButtonSize(device) + iconSpacing : 0; } int titleOffset(); void drawTitleBar(QPainter *painter); |