summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristian Ehrlicher <ch.ehrlicher@gmx.de>2018-11-23 22:05:04 +0100
committerChristian Ehrlicher <ch.ehrlicher@gmx.de>2018-12-04 07:00:37 +0000
commit8c38b08343b226883ef368d31a085b0a620f7995 (patch)
treec37fdda25e16c4c2ce5cda1ba00a69dc2d1a5613 /src
parent652098d40fab7c1085b913487809c6237eb2d49d (diff)
QFormLayout: Fix width calculation when a row has no label
The calculation of the minimum width assumes that when there is no label for a row, the field occupies the full row. But this is only true when QFormLayout::SpanningRole is set for this row. This lead to a to small minimum size for the row / truncated widgets when the row in question is the longest one in the form layout. Fix it by checking if it is a spanned row instead if there is not label when calculating the sizes. Fixes: QTBUG-18308 Fixes: QTBUG-60800 Change-Id: I1a610c93ab5c7f9cac503721ae99b36f2710c634 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/widgets/kernel/qformlayout.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/widgets/kernel/qformlayout.cpp b/src/widgets/kernel/qformlayout.cpp
index 66e8858e21..101ce8b64c 100644
--- a/src/widgets/kernel/qformlayout.cpp
+++ b/src/widgets/kernel/qformlayout.cpp
@@ -419,13 +419,15 @@ void QFormLayoutPrivate::updateSizes()
if (label) {
maxMinLblWidth = qMax(maxMinLblWidth, label->minSize.width());
maxShLblWidth = qMax(maxShLblWidth, label->sizeHint.width());
- if (field) {
+ }
+ if (field) {
+ if (field->fullRow) {
+ maxMinIfldWidth = qMax(maxMinIfldWidth, field->minSize.width());
+ maxShIfldWidth = qMax(maxShIfldWidth, field->sizeHint.width());
+ } else {
maxMinFldWidth = qMax(maxMinFldWidth, field->minSize.width() + field->sbsHSpace);
maxShFldWidth = qMax(maxShFldWidth, field->sizeHint.width() + field->sbsHSpace);
}
- } else if (field) {
- maxMinIfldWidth = qMax(maxMinIfldWidth, field->minSize.width());
- maxShIfldWidth = qMax(maxShIfldWidth, field->sizeHint.width());
}
prevLbl = label;