From 8c38b08343b226883ef368d31a085b0a620f7995 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Fri, 23 Nov 2018 22:05:04 +0100 Subject: 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 --- src/widgets/kernel/qformlayout.cpp | 10 ++++++---- 1 file 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; -- cgit v1.2.3