diff options
author | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2020-11-24 17:33:47 +0100 |
---|---|---|
committer | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2020-11-30 16:38:07 +0100 |
commit | 3013fce9931913b4f38d4707cb1327be1727a1ef (patch) | |
tree | 803457ca667836ea370b4c8ee748e4fd2bbe81cd /src | |
parent | 71249db0cb5feed40410486bcc4747abcf4f1ed9 (diff) |
Windows, CT_LineEdit: don't take dpr into account when calculating geometry
The geometry calculated by the style should not take dpr
into account. The nativestyle framework (and the scenegraph)
understands that all geometry returned by QStyle will need
to be scaled according to the dpr. We will for example
set a dpr on the QPainter (or the QImage it draws on) before
we ask QStyle to draw. This means that the style should not
scale the geometry used in the drawing calls to QPainter since
QPainter will do this automatically.
Task-number: QTBUG-89006
Pick-to: 6.0 6.0.0
Change-Id: Idfcc6690e0ae0062ca00cb829510d2b68c26ebd4
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/imports/nativestyle/qstyle/windows/qquickwindowsxpstyle.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/imports/nativestyle/qstyle/windows/qquickwindowsxpstyle.cpp b/src/imports/nativestyle/qstyle/windows/qquickwindowsxpstyle.cpp index 9221314d..0f07aef0 100644 --- a/src/imports/nativestyle/qstyle/windows/qquickwindowsxpstyle.cpp +++ b/src/imports/nativestyle/qstyle/windows/qquickwindowsxpstyle.cpp @@ -3444,19 +3444,17 @@ QSize QWindowsXPStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt case CT_LineEdit: case CT_ComboBox: { - const qreal factor = QWindowsXPStylePrivate::nativeMetricScaleFactor(option); if (contentsSize.isEmpty()) { // Minimum size - return QSize(20, 20) / factor; + return QSize(20, 20); } XPThemeData buttontheme(option->window, nullptr, QWindowsXPStylePrivate::ButtonTheme, BP_PUSHBUTTON, PBS_NORMAL); if (buttontheme.isValid()) { - const QMarginsF borderSize = buttontheme.margins() * factor; + const QMarginsF borderSize = buttontheme.margins(); if (!borderSize.isNull()) { - const qreal margin = qreal(2) * factor; + const qreal margin = qreal(2); sz.rwidth() += qRound(borderSize.left() + borderSize.right() - margin); - sz.rheight() += int(borderSize.bottom() + borderSize.top() - margin - + qreal(1) / factor - 1); + sz.rheight() += int(borderSize.bottom() + borderSize.top() - margin); } const int textMargins = 2*(proxy()->pixelMetric(PM_FocusFrameHMargin, option) + 1); sz += QSize(qMax(pixelMetric(QStyle::PM_ScrollBarExtent, option) |