diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2016-08-18 14:23:19 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2016-08-25 06:50:22 +0000 |
commit | d0012ad64cd6733c072dd18cf82edef4ded32f95 (patch) | |
tree | 53760364c0d69f311cb1d78b1d2acae30ba89700 /src/widgets/styles/qwindowsvistastyle.cpp | |
parent | 2aea77dbcb8a3da40cf040bef63977514708056b (diff) |
Windows style: Scale more native metrics per monitor
Fix a few places that were overlooked in
change 29c6e39086831f6811e94364273c1f4bff119bef.
Most notably, fixes MDI subwindow titles disappearing
when moving windows between monitors.
Task-number: QTBUG-49374
Change-Id: Ie6ffabc4909064e649a3820d9aa952f3991ef06b
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'src/widgets/styles/qwindowsvistastyle.cpp')
-rw-r--r-- | src/widgets/styles/qwindowsvistastyle.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp index fe9684a25f..52006815ed 100644 --- a/src/widgets/styles/qwindowsvistastyle.cpp +++ b/src/widgets/styles/qwindowsvistastyle.cpp @@ -1175,9 +1175,9 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption case CE_MenuItem: if (const QStyleOptionMenuItem *menuitem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) { // windows always has a check column, regardless whether we have an icon or not - const qreal devicePixelRatio = QWindowsXPStylePrivate::devicePixelRatio(widget); - int checkcol = qRound(qreal(25) / devicePixelRatio); - const int gutterWidth = qRound(qreal(3) / devicePixelRatio); + const qreal factor = QWindowsXPStylePrivate::nativeMetricScaleFactor(widget); + int checkcol = qRound(qreal(25) * factor); + const int gutterWidth = qRound(qreal(3) * factor); { XPThemeData theme(widget, 0, QWindowsXPStylePrivate::MenuTheme, MENU_POPUPCHECKBACKGROUND, MBI_HOT); @@ -2166,8 +2166,9 @@ QRect QWindowsVistaStyle::subControlRect(ComplexControl control, const QStyleOpt const bool isToolTitle = false; const int height = tb->rect.height(); const int width = tb->rect.width(); - int buttonWidth = GetSystemMetrics(SM_CXSIZE) / QWindowsStylePrivate::devicePixelRatio(widget) - - int(QStyleHelper::dpiScaled(4)); + const int buttonWidth = + qRound(qreal(GetSystemMetrics(SM_CXSIZE)) * QWindowsStylePrivate::nativeMetricScaleFactor(widget) + - QStyleHelper::dpiScaled(4)); const int frameWidth = proxy()->pixelMetric(PM_MdiSubWindowFrameWidth, option, widget); const bool sysmenuHint = (tb->titleBarFlags & Qt::WindowSystemMenuHint) != 0; |