aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/nativestyle
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2020-11-20 09:36:21 +0100
committerRichard Moe Gustavsen <richard.gustavsen@qt.io>2020-11-20 15:47:25 +0100
commit54bc5fbc5e0ebfa42841aa78d621654142b36a59 (patch)
treeb65f4048a7c2d5a8a66958b423ba000ff9961f9a /src/imports/nativestyle
parent7fbc14053cb3db4b0cfe31d00da158720d7c24ee (diff)
Windows, TextField: ensure we set a valid minimum size
The current implementation would sometimes return a minimum size with a height equal to 3. And when trying to divide the image at the center for use with a nine patch image later, we would get drawing artifacts. This patch will ensure that we set a valid minimumsize. Pick-to: 6.0 Change-Id: I9ee72c525966462ced596c5191153d3e2a0d68fe Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'src/imports/nativestyle')
-rw-r--r--src/imports/nativestyle/qstyle/windows/qquickwindowsxpstyle.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/imports/nativestyle/qstyle/windows/qquickwindowsxpstyle.cpp b/src/imports/nativestyle/qstyle/windows/qquickwindowsxpstyle.cpp
index f4defe49..9221314d 100644
--- a/src/imports/nativestyle/qstyle/windows/qquickwindowsxpstyle.cpp
+++ b/src/imports/nativestyle/qstyle/windows/qquickwindowsxpstyle.cpp
@@ -3444,9 +3444,13 @@ 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;
+ }
XPThemeData buttontheme(option->window, nullptr, QWindowsXPStylePrivate::ButtonTheme, BP_PUSHBUTTON, PBS_NORMAL);
if (buttontheme.isValid()) {
- const qreal factor = QWindowsXPStylePrivate::nativeMetricScaleFactor(option);
const QMarginsF borderSize = buttontheme.margins() * factor;
if (!borderSize.isNull()) {
const qreal margin = qreal(2) * factor;