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>
This commit is contained in:
parent
652098d40f
commit
8c38b08343
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user