diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-04-29 15:01:04 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-05-06 07:57:11 (GMT) |
commit | 244f5ee9c2c34ddee200e4d5cdc1345762a5901b (patch) | |
tree | 12841f52f170972109281ea4115147ff0e063289 /src/gui/kernel/qformlayout.cpp | |
parent | 548da9a5434d615456a7a6efda3380b7138c6000 (diff) | |
download | Qt-244f5ee9c2c34ddee200e4d5cdc1345762a5901b.zip Qt-244f5ee9c2c34ddee200e4d5cdc1345762a5901b.tar.gz Qt-244f5ee9c2c34ddee200e4d5cdc1345762a5901b.tar.bz2 |
Fix QFormLayout which allowed fields to be smaller that their minimum size
If the label's sizeHint is bigger than its minimumSizeHint, the field
may be resized smaller than its minimum size.
This also fix another problem where the field would 'jump' from one
sizehint to the others.
(This can happen if labels can word-wrap for example)
Reviewed-by: Michael Goddard
Diffstat (limited to 'src/gui/kernel/qformlayout.cpp')
-rw-r--r-- | src/gui/kernel/qformlayout.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/gui/kernel/qformlayout.cpp b/src/gui/kernel/qformlayout.cpp index e2d6108..a665c89 100644 --- a/src/gui/kernel/qformlayout.cpp +++ b/src/gui/kernel/qformlayout.cpp @@ -689,12 +689,16 @@ void QFormLayoutPrivate::setupVerticalLayoutData(int width) // are split. maxLabelWidth = 0; if (!wrapAllRows) { + int maxFieldMinWidth = 0; //the maximum minimum size of the field for (int i = 0; i < rr; ++i) { const QFormLayoutItem *label = m_matrix(i, 0); const QFormLayoutItem *field = m_matrix(i, 1); - if (label && (label->sizeHint.width() + (field ? field->minSize.width() : 0) <= width)) + if (label && field && label->sideBySide) maxLabelWidth = qMax(maxLabelWidth, label->sizeHint.width()); + if (field) + maxFieldMinWidth = qMax(maxFieldMinWidth, field->minSize.width() + field->sbsHSpace); } + maxLabelWidth = qMin(maxLabelWidth, width - maxFieldMinWidth); } else { maxLabelWidth = width; } |