summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/kernel/qformlayout.cpp6
-rw-r--r--tests/auto/qformlayout/tst_qformlayout.cpp30
2 files changed, 1 insertions, 35 deletions
diff --git a/src/gui/kernel/qformlayout.cpp b/src/gui/kernel/qformlayout.cpp
index 0b7656f..de33f93 100644
--- a/src/gui/kernel/qformlayout.cpp
+++ b/src/gui/kernel/qformlayout.cpp
@@ -689,16 +689,12 @@ 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 && field && label->sideBySide)
+ if (label && (label->sizeHint.width() + (field ? field->minSize.width() : 0) <= width))
maxLabelWidth = qMax(maxLabelWidth, label->sizeHint.width());
- if (field)
- maxFieldMinWidth = qMax(maxFieldMinWidth, field->minSize.width() + field->sbsHSpace);
}
- maxLabelWidth = qMin(maxLabelWidth, width - maxFieldMinWidth);
} else {
maxLabelWidth = width;
}
diff --git a/tests/auto/qformlayout/tst_qformlayout.cpp b/tests/auto/qformlayout/tst_qformlayout.cpp
index 74384a9..9806557 100644
--- a/tests/auto/qformlayout/tst_qformlayout.cpp
+++ b/tests/auto/qformlayout/tst_qformlayout.cpp
@@ -125,7 +125,6 @@ private slots:
Qt::Orientations expandingDirections() const;
*/
- void fieldMinimumSize();
};
tst_QFormLayout::tst_QFormLayout()
@@ -906,35 +905,6 @@ void tst_QFormLayout::layoutAlone()
QTest::qWait(500);
}
-
-void tst_QFormLayout::fieldMinimumSize()
-{
- //check that the field with is bigger than its minimumSizeHint for any size of the widget
- // even if the label with is not fixed
- QWidget w;
- QFormLayout layout;
- layout.setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
- w.setLayout(&layout);
- QLabel label1("Here is a strange test case");
- label1.setWordWrap(true);
- QLabel label2("Here is another label");
- label2.setWordWrap(true);
- QLabel shortLabel("short");
- QLabel longLabel("Quite long label");
- layout.addRow(&label1, &shortLabel);
- layout.addRow(&label2, &longLabel);
- w.show();
- int width = w.size().width() + 9;
-
- do {
- w.resize(width, w.size().height());
- layout.activate();
- QVERIFY(shortLabel.size().width() >= shortLabel.minimumSizeHint().width());
- QVERIFY(longLabel.size().width() >= longLabel.minimumSizeHint().width());
- width -= 3;
- } while(width >= w.minimumSizeHint().width());
-}
-
QTEST_MAIN(tst_QFormLayout)
#include "tst_qformlayout.moc"