summaryrefslogtreecommitdiffstats
path: root/src/widgets/styles
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2016-04-08 14:11:48 +0200
committerFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2016-04-19 20:26:24 +0000
commitcec15a89d058424794978910cc8da65b43d71606 (patch)
tree87ca76e3bfdeb723ddb1f68c27f1e7e814b5e96c /src/widgets/styles
parent5fb2dceab46ede44346a192a9f270b2bb002b5a5 (diff)
QWindowsXPStyle: Enlarge QLineEdit/QComboBox when High DPI scaling is active.
In QWindowsXPStyle::sizeFromContents(), scale the margins using the devicePixelRatio and round the height up. Typically increases the height by 2 pixels when the device pixel ratio equals 2. Change-Id: I446ad518c3808a6454a08db7b66a942d37c1703f Task-number: QTBUG-49374 Reviewed-by: Alessandro Portale <alessandro.portale@theqtcompany.com>
Diffstat (limited to 'src/widgets/styles')
-rw-r--r--src/widgets/styles/qwindowsxpstyle.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp
index fbf8a850fa..e9415f4292 100644
--- a/src/widgets/styles/qwindowsxpstyle.cpp
+++ b/src/widgets/styles/qwindowsxpstyle.cpp
@@ -3793,10 +3793,12 @@ QSize QWindowsXPStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt
{
XPThemeData buttontheme(widget, 0, QWindowsXPStylePrivate::ButtonTheme, BP_PUSHBUTTON, PBS_NORMAL);
if (buttontheme.isValid()) {
- const QMarginsF borderSize = buttontheme.margins() / QWindowsXPStylePrivate::devicePixelRatio(widget);
+ const qreal devicePixelRatio = QWindowsXPStylePrivate::devicePixelRatio(widget);
+ const QMarginsF borderSize = buttontheme.margins() / devicePixelRatio;
if (!borderSize.isNull()) {
- sz.rwidth() += qRound(borderSize.left() + borderSize.right() - 2);
- sz.rheight() += qRound(borderSize.bottom() + borderSize.top() - 2);
+ const qreal margin = qreal(2) / devicePixelRatio;
+ sz.rwidth() += qRound(borderSize.left() + borderSize.right() - margin);
+ sz.rheight() += int(borderSize.bottom() + borderSize.top() - margin + devicePixelRatio - 1);
}
const int textMargins = 2*(proxy()->pixelMetric(PM_FocusFrameHMargin) + 1);
sz += QSize(qMax(pixelMetric(QStyle::PM_ScrollBarExtent, option, widget)