summaryrefslogtreecommitdiffstats
path: root/src/gui/styles
diff options
context:
space:
mode:
authorJens Bache-Wiig <jens.bache-wiig@nokia.com>2009-06-25 14:35:55 (GMT)
committerJens Bache-Wiig <jens.bache-wiig@nokia.com>2009-06-25 14:37:04 (GMT)
commitdb24e82b6b74be303492f186a45d784fcd84fdc6 (patch)
tree13b3358df74d262a97356c5759a77debec4051bc /src/gui/styles
parent47c9e7b1b3551ff6dbe71590461a45ae398a9501 (diff)
downloadQt-db24e82b6b74be303492f186a45d784fcd84fdc6.zip
Qt-db24e82b6b74be303492f186a45d784fcd84fdc6.tar.gz
Qt-db24e82b6b74be303492f186a45d784fcd84fdc6.tar.bz2
Improved support for DPI on Mac and Vista/7
This significantly improves the support for higher DPI-values on these platforms by ensuring that common pixelmetrics are scaled accordingly. In addition we mark all Qt apps as DPI-aware on Windows 7 by calling SetProcessDPIAware. We also changed the way we draw pixmaps on the mac paintengine when using dpi scaling > 1 to ensure smooth pixmap scaling. Reviewed-by: nrc Task-id: 242417
Diffstat (limited to 'src/gui/styles')
-rw-r--r--src/gui/styles/qcommonstyle.cpp80
-rw-r--r--src/gui/styles/qstylehelper.cpp27
-rw-r--r--src/gui/styles/qstylehelper_p.h1
-rw-r--r--src/gui/styles/qwindowsstyle.cpp26
-rw-r--r--src/gui/styles/qwindowsvistastyle.cpp79
-rw-r--r--src/gui/styles/qwindowsxpstyle.cpp12
6 files changed, 150 insertions, 75 deletions
diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp
index ed3bdb5..7b8b75e 100644
--- a/src/gui/styles/qcommonstyle.cpp
+++ b/src/gui/styles/qcommonstyle.cpp
@@ -4535,17 +4535,17 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
ret = 0;
break;
case PM_DialogButtonsSeparator:
- ret = 5;
+ ret = int(QStyleHelper::dpiScaled(5.));
break;
case PM_DialogButtonsButtonWidth:
- ret = 70;
+ ret = int(QStyleHelper::dpiScaled(70.));
break;
case PM_DialogButtonsButtonHeight:
- ret = 30;
+ ret = int(QStyleHelper::dpiScaled(30.));
break;
case PM_CheckListControllerSize:
case PM_CheckListButtonSize:
- ret = 16;
+ ret = int(QStyleHelper::dpiScaled(16.));
break;
case PM_TitleBarHeight: {
if (const QStyleOptionTitleBar *tb = qstyleoption_cast<const QStyleOptionTitleBar *>(opt)) {
@@ -4553,26 +4553,26 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
ret = qMax(widget ? widget->fontMetrics().lineSpacing() : opt->fontMetrics.lineSpacing(), 16);
#ifndef QT_NO_DOCKWIDGET
} else if (qobject_cast<const QDockWidget*>(widget)) {
- ret = qMax(widget->fontMetrics().lineSpacing(), 13);
+ ret = qMax(widget->fontMetrics().lineSpacing(), int(QStyleHelper::dpiScaled(13)));
#endif
} else {
ret = qMax(widget ? widget->fontMetrics().lineSpacing() : opt->fontMetrics.lineSpacing(), 18);
}
} else {
- ret = 18;
+ ret = int(QStyleHelper::dpiScaled(18.));
}
break; }
case PM_ScrollBarSliderMin:
- ret = 9;
+ ret = int(QStyleHelper::dpiScaled(9.));
break;
case PM_ButtonMargin:
- ret = 6;
+ ret = int(QStyleHelper::dpiScaled(6.));
break;
case PM_DockWidgetTitleBarButtonMargin:
- ret = 2;
+ ret = int(QStyleHelper::dpiScaled(2.));
break;
case PM_ButtonDefaultIndicator:
@@ -4580,7 +4580,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
break;
case PM_MenuButtonIndicator:
- ret = 12;
+ ret = int(QStyleHelper::dpiScaled(12.));
break;
case PM_ButtonShiftHorizontal:
@@ -4599,11 +4599,11 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
break;
case PM_MdiSubWindowFrameWidth:
- ret = 4;
+ ret = int(QStyleHelper::dpiScaled(4.));
break;
case PM_MdiSubWindowMinimizedWidth:
- ret = 196;
+ ret = int(QStyleHelper::dpiScaled(196.));
break;
#ifndef QT_NO_SCROLLBAR
@@ -4614,7 +4614,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
: QApplication::globalStrut().width();
ret = qMax(16, s);
} else {
- ret = 16;
+ ret = int(QStyleHelper::dpiScaled(16.));
}
break;
#endif
@@ -4624,7 +4624,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
#ifndef QT_NO_SLIDER
case PM_SliderThickness:
- ret = 16;
+ ret = int(QStyleHelper::dpiScaled(16.));
break;
case PM_SliderTickmarkOffset:
@@ -4658,11 +4658,11 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
#endif // QT_NO_SLIDER
#ifndef QT_NO_DOCKWIDGET
case PM_DockWidgetSeparatorExtent:
- ret = 6;
+ ret = int(QStyleHelper::dpiScaled(6.));
break;
case PM_DockWidgetHandleExtent:
- ret = 8;
+ ret = int(QStyleHelper::dpiScaled(8.));
break;
case PM_DockWidgetTitleMargin:
ret = 0;
@@ -4691,19 +4691,19 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
break;
case PM_ToolBarItemSpacing:
- ret = 4;
+ ret = int(QStyleHelper::dpiScaled(4.));
break;
case PM_ToolBarHandleExtent:
- ret = 8;
+ ret = int(QStyleHelper::dpiScaled(8.));
break;
case PM_ToolBarSeparatorExtent:
- ret = 6;
+ ret = int(QStyleHelper::dpiScaled(6.));
break;
case PM_ToolBarExtensionExtent:
- ret = 12;
+ ret = int(QStyleHelper::dpiScaled(12.));
break;
#endif // QT_NO_TOOLBAR
@@ -4713,7 +4713,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
break;
case PM_TabBarTabHSpace:
- ret = 24;
+ ret = int(QStyleHelper::dpiScaled(24.));
break;
case PM_TabBarTabShiftHorizontal:
@@ -4742,27 +4742,27 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
break;
case PM_IndicatorWidth:
- ret = 13;
+ ret = int(QStyleHelper::dpiScaled(13.));
break;
case PM_IndicatorHeight:
- ret = 13;
+ ret = int(QStyleHelper::dpiScaled(13.));
break;
case PM_ExclusiveIndicatorWidth:
- ret = 12;
+ ret = int(QStyleHelper::dpiScaled(12.));
break;
case PM_ExclusiveIndicatorHeight:
- ret = 12;
+ ret = int(QStyleHelper::dpiScaled(12.));
break;
case PM_MenuTearoffHeight:
- ret = 10;
+ ret = int(QStyleHelper::dpiScaled(10.));
break;
case PM_MenuScrollerHeight:
- ret = 10;
+ ret = int(QStyleHelper::dpiScaled(10.));
break;
case PM_MenuDesktopFrameWidth:
@@ -4772,16 +4772,16 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
break;
case PM_HeaderMargin:
- ret = 4;
+ ret = int(QStyleHelper::dpiScaled(4.));
break;
case PM_HeaderMarkSize:
- ret = 32;
+ ret = int(QStyleHelper::dpiScaled(32.));
break;
case PM_HeaderGripMargin:
- ret = 4;
+ ret = int(QStyleHelper::dpiScaled(4.));
break;
case PM_TabBarScrollButtonWidth:
- ret = 16;
+ ret = int(QStyleHelper::dpiScaled(16.));
break;
case PM_LayoutLeftMargin:
case PM_LayoutTopMargin:
@@ -4803,13 +4803,13 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
break;
case PM_DefaultTopLevelMargin:
- ret = 11;
+ ret = int(QStyleHelper::dpiScaled(11.));
break;
case PM_DefaultChildMargin:
- ret = 9;
+ ret = int(QStyleHelper::dpiScaled(9.));
break;
case PM_DefaultLayoutSpacing:
- ret = 6;
+ ret = int(QStyleHelper::dpiScaled(6.));
break;
case PM_TabBarIconSize:
@@ -4820,14 +4820,14 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
case PM_ButtonIconSize:
case PM_SmallIconSize:
- ret = 16;
+ ret = int(QStyleHelper::dpiScaled(16.));
break;
case PM_IconViewIconSize:
ret = proxy()->pixelMetric(PM_LargeIconSize, opt, widget);
break;
case PM_LargeIconSize:
- ret = 32;
+ ret = int(QStyleHelper::dpiScaled(32.));
break;
case PM_ToolTipLabelFrameWidth:
@@ -4835,13 +4835,13 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
break;
case PM_CheckBoxLabelSpacing:
case PM_RadioButtonLabelSpacing:
- ret = 6;
+ ret = int(QStyleHelper::dpiScaled(6.));
break;
case PM_SizeGripSize:
- ret = 13;
+ ret = int(QStyleHelper::dpiScaled(13.));
break;
case PM_MessageBoxIconSize:
- ret = 32;
+ ret = int(QStyleHelper::dpiScaled(32.));
break;
case PM_TextCursorWidth:
ret = 1;
@@ -4851,7 +4851,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
break;
case PM_TabCloseIndicatorWidth:
case PM_TabCloseIndicatorHeight:
- ret = 16;
+ ret = int(QStyleHelper::dpiScaled(16.));
break;
case PM_ScrollView_ScrollBarSpacing:
ret = 2 * proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget);
diff --git a/src/gui/styles/qstylehelper.cpp b/src/gui/styles/qstylehelper.cpp
index 997bd68..f9010e8 100644
--- a/src/gui/styles/qstylehelper.cpp
+++ b/src/gui/styles/qstylehelper.cpp
@@ -48,6 +48,12 @@
#include <private/qstyle_p.h>
#include <qmath.h>
+#if defined(Q_WS_WIN)
+#include "qt_windows.h"
+#elif defined(Q_WS_MAC)
+#include <private/qt_cocoa_helpers_mac_p.h>
+#endif
+
QT_BEGIN_NAMESPACE
namespace QStyleHelper {
@@ -72,6 +78,26 @@ QString uniqueName(const QString &key, const QStyleOption *option, const QSize &
return tmp;
}
+qreal dpiScaled(qreal value)
+{
+ static qreal scale = -1;
+ if (scale < 0) {
+ scale = 1.0;
+#if defined(Q_WS_WIN)
+ {
+ HDC hdcScreen = GetDC(0);
+ int dpi = GetDeviceCaps(hdcScreen, LOGPIXELSX);
+ ReleaseDC(0, hdcScreen);
+ scale = dpi/96.0;
+ }
+#elif defined(Q_WS_MAC)
+ scale = qt_mac_get_scalefactor();
+#endif
+ }
+ return value * scale;
+}
+
+
#ifndef QT_NO_DIAL
int calcBigLineSize(int radius)
@@ -178,7 +204,6 @@ QPolygonF calcLines(const QStyleOptionSlider *dial)
return poly;
}
-
// This will draw a nice and shiny QDial for us. We don't want
// all the shinyness in QWindowsStyle, hence we place it here
diff --git a/src/gui/styles/qstylehelper_p.h b/src/gui/styles/qstylehelper_p.h
index 7099e87..cac88e2 100644
--- a/src/gui/styles/qstylehelper_p.h
+++ b/src/gui/styles/qstylehelper_p.h
@@ -67,6 +67,7 @@ class QStyleOption;
namespace QStyleHelper
{
QString uniqueName(const QString &key, const QStyleOption *option, const QSize &size);
+ qreal dpiScaled(qreal value);
#ifndef QT_NO_DIAL
qreal angle(const QPointF &p1, const QPointF &p2);
QPolygonF calcLines(const QStyleOptionSlider *dial);
diff --git a/src/gui/styles/qwindowsstyle.cpp b/src/gui/styles/qwindowsstyle.cpp
index 39743b0..997c2ce 100644
--- a/src/gui/styles/qwindowsstyle.cpp
+++ b/src/gui/styles/qwindowsstyle.cpp
@@ -42,6 +42,7 @@
#include "qwindowsstyle.h"
#include "qwindowsstyle_p.h"
#include <private/qpixmapdata_p.h>
+#include <private/qstylehelper_p.h>
#if !defined(QT_NO_STYLE_WINDOWS) || defined(QT_PLUGIN)
@@ -405,7 +406,7 @@ int QWindowsStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QW
#ifndef QT_NO_SLIDER
case PM_SliderLength:
- ret = 11;
+ ret = int(QStyleHelper::dpiScaled(11.));
break;
// Returns the number of pixels to use for the business part of the
@@ -453,11 +454,11 @@ int QWindowsStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QW
break;
case PM_SmallIconSize:
- ret = 16;
+ ret = int(QStyleHelper::dpiScaled(16.));
break;
case PM_LargeIconSize:
- ret = 32;
+ ret = int(QStyleHelper::dpiScaled(32.));
break;
case PM_IconViewIconSize:
@@ -465,13 +466,13 @@ int QWindowsStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QW
break;
case PM_ToolBarIconSize:
- ret = 24;
+ ret = int(QStyleHelper::dpiScaled(24.));
break;
case PM_DockWidgetTitleMargin:
- ret = 2;
+ ret = int(QStyleHelper::dpiScaled(2.));
break;
case PM_DockWidgetTitleBarButtonMargin:
- ret = 4;
+ ret = int(QStyleHelper::dpiScaled(4.));
break;
#if defined(Q_WS_WIN)
case PM_DockWidgetFrameWidth:
@@ -553,7 +554,7 @@ int QWindowsStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QW
ret = 0;
break;
case PM_ToolBarHandleExtent:
- ret = 10;
+ ret = int(QStyleHelper::dpiScaled(10.));
break;
default:
ret = QCommonStyle::pixelMetric(pm, opt, widget);
@@ -3200,11 +3201,14 @@ QSize QWindowsStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
int defwidth = 0;
if (btn->features & QStyleOptionButton::AutoDefaultButton)
defwidth = 2 * proxy()->pixelMetric(PM_ButtonDefaultIndicator, btn, widget);
+ int minwidth = int(QStyleHelper::dpiScaled(75.));
+ int minheight = int(QStyleHelper::dpiScaled(23.));
+
#ifndef QT_QWS_SMALL_PUSHBUTTON
- if (w < 75 + defwidth && !btn->text.isEmpty())
- w = 75 + defwidth;
- if (h < 23 + defwidth)
- h = 23 + defwidth;
+ if (w < minwidth + defwidth && !btn->text.isEmpty())
+ w = minwidth + defwidth;
+ if (h < minheight + defwidth)
+ h = minheight + defwidth;
#endif
sz = QSize(w, h);
}
diff --git a/src/gui/styles/qwindowsvistastyle.cpp b/src/gui/styles/qwindowsvistastyle.cpp
index 7a75a7d..5f0f053 100644
--- a/src/gui/styles/qwindowsvistastyle.cpp
+++ b/src/gui/styles/qwindowsvistastyle.cpp
@@ -41,6 +41,7 @@
#include "qwindowsvistastyle.h"
#include "qwindowsvistastyle_p.h"
+#include <private/qstylehelper_p.h>
#if !defined(QT_NO_STYLE_WINDOWSVISTA) || defined(QT_PLUGIN)
@@ -487,7 +488,12 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
case PE_IndicatorBranch:
{
XPThemeData theme(d->treeViewHelper(), painter, QLatin1String("TREEVIEW"));
- static const int decoration_size = 16;
+ static int decoration_size = 0;
+ if (theme.isValid() && !decoration_size) {
+ SIZE size;
+ pGetThemePartSize(theme.handle(), 0, TVP_HOTGLYPH, GLPS_OPENED, 0, TS_TRUE, &size);
+ decoration_size = qMax(size.cx, size.cy);
+ }
int mid_h = option->rect.x() + option->rect.width() / 2;
int mid_v = option->rect.y() + option->rect.height() / 2;
int bef_h = mid_h;
@@ -535,17 +541,6 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
}
break;
- case PE_IndicatorToolBarHandle:
- {
- XPThemeData theme;
- if (option->state & State_Horizontal)
- theme = XPThemeData(widget, painter, QLatin1String("REBAR"), RP_GRIPPER, ETS_NORMAL, option->rect.adjusted(0, 1, -2, -2));
- else
- theme = XPThemeData(widget, painter, QLatin1String("REBAR"), RP_GRIPPERVERT, ETS_NORMAL, option->rect.adjusted(0, 1, -2, -2));
- d->drawBackground(theme);
- }
- break;
-
case PE_FrameMenu:
{
int stateId = option->state & State_Active ? MB_ACTIVE : MB_INACTIVE;
@@ -694,6 +689,24 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
}
break;
+ case PE_IndicatorToolBarHandle:
+ {
+ XPThemeData theme;
+ QRect rect;
+ if (option->state & State_Horizontal) {
+ theme = XPThemeData(widget, painter, QLatin1String("REBAR"), RP_GRIPPER, ETS_NORMAL, option->rect.adjusted(0, 1, -2, -2));
+ rect = option->rect.adjusted(0, 1, 0, -2);
+ rect.setWidth(4);
+ } else {
+ theme = XPThemeData(widget, painter, QLatin1String("REBAR"), RP_GRIPPERVERT, ETS_NORMAL, option->rect.adjusted(0, 1, -2, -2));
+ rect = option->rect.adjusted(1, 0, -1, 0);
+ rect.setHeight(4);
+ }
+ theme.rect = rect;
+ d->drawBackground(theme);
+ }
+ break;
+
case PE_IndicatorToolBarSeparator:
{
QPen pen = painter->pen();
@@ -1230,7 +1243,15 @@ 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
- int checkcol = qMax(menuitem->maxIconWidth, 28);
+ int checkcol = 28;
+ {
+ SIZE size;
+ MARGINS margins;
+ XPThemeData theme(widget, 0, QLatin1String("MENU"), MENU_POPUPCHECKBACKGROUND, MBI_HOT);
+ pGetThemePartSize(theme.handle(), NULL, MENU_POPUPCHECK, 0, NULL,TS_TRUE, &size);
+ pGetThemeMargins(theme.handle(), NULL, MENU_POPUPCHECK, 0, TMT_CONTENTMARGINS, NULL, &margins);
+ checkcol = qMax(menuitem->maxIconWidth, int(6 + size.cx + margins.cxLeftWidth + margins.cxRightWidth));
+ }
QColor darkLine = option->palette.background().color().darker(108);
QColor lightLine = option->palette.background().color().lighter(107);
QRect rect = option->rect;
@@ -1275,8 +1296,23 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
if (checked) {
XPThemeData theme(widget, painter, QLatin1String("MENU"), MENU_POPUPCHECKBACKGROUND,
menuitem->icon.isNull() ? MBI_HOT : MBI_PUSHED, vCheckRect);
+ SIZE size;
+ MARGINS margins;
+ pGetThemePartSize(theme.handle(), NULL, MENU_POPUPCHECK, 0, NULL,TS_TRUE, &size);
+ pGetThemeMargins(theme.handle(), NULL, MENU_POPUPCHECK, 0,
+ TMT_CONTENTMARGINS, NULL, &margins);
+ QRect checkRect(0, 0, size.cx + margins.cxLeftWidth + margins.cxRightWidth ,
+ size.cy + margins.cyBottomHeight + margins.cyTopHeight);
+ checkRect.moveCenter(vCheckRect.center());
+ theme.rect = checkRect;
+
d->drawBackground(theme);
+
if (menuitem->icon.isNull()) {
+ checkRect = QRect(0, 0, size.cx, size.cy);
+ checkRect.moveCenter(theme.rect.center());
+ theme.rect = checkRect;
+
theme.partId = MENU_POPUPCHECK;
bool bullet = menuitem->checkType & QStyleOptionMenuItem::Exclusive;
if (dis)
@@ -1926,9 +1962,18 @@ QSize QWindowsVistaStyle::sizeFromContents(ContentsType type, const QStyleOption
return sz;
case CT_MenuItem:
sz = QWindowsXPStyle::sizeFromContents(type, option, size, widget);
- sz.rwidth() += 28;
+ int minimumHeight;
+ {
+ SIZE size;
+ MARGINS margins;
+ XPThemeData theme(widget, 0, QLatin1String("MENU"), MENU_POPUPCHECKBACKGROUND, MBI_HOT);
+ pGetThemePartSize(theme.handle(), NULL, MENU_POPUPCHECK, 0, NULL,TS_TRUE, &size);
+ pGetThemeMargins(theme.handle(), NULL, MENU_POPUPCHECK, 0, TMT_CONTENTMARGINS, NULL, &margins);
+ minimumHeight = qMax<qint32>(size.cy + margins.cyBottomHeight+ margins.cyTopHeight, sz.height());
+ sz.rwidth() += size.cx + margins.cxLeftWidth + margins.cxRightWidth;
+ }
+
if (const QStyleOptionMenuItem *menuitem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
- int minimumHeight = qMax<qint32>(22, sz.height());
if (menuitem->menuItemType != QStyleOptionMenuItem::Separator)
sz.setHeight(minimumHeight);
}
@@ -2318,9 +2363,9 @@ int QWindowsVistaStyle::pixelMetric(PixelMetric metric, const QStyleOption *opti
switch (metric) {
case PM_DockWidgetTitleBarButtonMargin:
- return 5;
+ return int(QStyleHelper::dpiScaled(5.));
case PM_ScrollBarSliderMin:
- return 18;
+ return int(QStyleHelper::dpiScaled(18.));
case PM_MenuHMargin:
case PM_MenuVMargin:
return 0;
diff --git a/src/gui/styles/qwindowsxpstyle.cpp b/src/gui/styles/qwindowsxpstyle.cpp
index b0eae1f..322bfac 100644
--- a/src/gui/styles/qwindowsxpstyle.cpp
+++ b/src/gui/styles/qwindowsxpstyle.cpp
@@ -3235,7 +3235,7 @@ int QWindowsXPStyle::pixelMetric(PixelMetric pm, const QStyleOption *option, con
break;
case PM_SplitterWidth:
- res = qMax(5, QApplication::globalStrut().width());
+ res = qMax(int(QStyleHelper::dpiScaled(5.)), QApplication::globalStrut().width());
break;
case PM_IndicatorWidth:
@@ -3245,7 +3245,7 @@ int QWindowsXPStyle::pixelMetric(PixelMetric pm, const QStyleOption *option, con
if (theme.isValid()) {
SIZE size;
pGetThemePartSize(theme.handle(), 0, theme.partId, theme.stateId, 0, TS_TRUE, &size);
- res = (pm == PM_IndicatorWidth ? size.cx+2 : res = size.cy+2);
+ res = (pm == PM_IndicatorWidth ? size.cx : res = size.cy);
}
}
break;
@@ -3257,7 +3257,7 @@ int QWindowsXPStyle::pixelMetric(PixelMetric pm, const QStyleOption *option, con
if (theme.isValid()) {
SIZE size;
pGetThemePartSize(theme.handle(), 0, theme.partId, theme.stateId, 0, TS_TRUE, &size);
- res = (pm == PM_ExclusiveIndicatorWidth ? size.cx+2 : res = size.cy+2);
+ res = (pm == PM_ExclusiveIndicatorWidth ? size.cx : res = size.cy);
}
}
break;
@@ -3329,7 +3329,7 @@ int QWindowsXPStyle::pixelMetric(PixelMetric pm, const QStyleOption *option, con
#ifndef QT_NO_TOOLBAR
case PM_ToolBarHandleExtent:
- res = 8;
+ res = int(QStyleHelper::dpiScaled(8.));
break;
#endif // QT_NO_TOOLBAR
@@ -3344,10 +3344,10 @@ int QWindowsXPStyle::pixelMetric(PixelMetric pm, const QStyleOption *option, con
}
break;
case PM_DockWidgetSeparatorExtent:
- res = 4;
+ res = int(QStyleHelper::dpiScaled(4.));
break;
case PM_DockWidgetTitleMargin:
- res = 4;
+ res = int(QStyleHelper::dpiScaled(4.));
break;
case PM_ButtonShiftHorizontal: