diff options
author | Gabriel de Dietrich <gabriel.dietrich-de@nokia.com> | 2010-01-06 14:36:21 (GMT) |
---|---|---|
committer | Gabriel de Dietrich <gabriel.dietrich-de@nokia.com> | 2010-01-06 15:05:12 (GMT) |
commit | 94759a0ed565b21c8dbfb4b12bfe6064f156b410 (patch) | |
tree | 617a60355fa612c0ca2a8a07cf5279eb6fc28eb0 /src/gui/kernel | |
parent | 092f2014cf81d9f58670ede7d381022dd6903cbb (diff) | |
download | Qt-94759a0ed565b21c8dbfb4b12bfe6064f156b410.zip Qt-94759a0ed565b21c8dbfb4b12bfe6064f156b410.tar.gz Qt-94759a0ed565b21c8dbfb4b12bfe6064f156b410.tar.bz2 |
QBoxLayout::setGeometry would not respect the widget min/max width
When calling heightforWidth after a geometry change, the width actually used
could be outside the widget's width bounds. The height could then be smaller
than needed to fit the widget's contents resulting in a clipped widget being
drawn. Auto-test included.
Reviewed-by: Olivier
Task-number: QTBUG-7103
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qboxlayout.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/gui/kernel/qboxlayout.cpp b/src/gui/kernel/qboxlayout.cpp index d965933..fd16861 100644 --- a/src/gui/kernel/qboxlayout.cpp +++ b/src/gui/kernel/qboxlayout.cpp @@ -830,9 +830,11 @@ void QBoxLayout::setGeometry(const QRect &r) if (d->hasHfw && !horz(d->dir)) { for (int i = 0; i < n; i++) { QBoxLayoutItem *box = d->list.at(i); - if (box->item->hasHeightForWidth()) + if (box->item->hasHeightForWidth()) { + int width = qBound(box->item->minimumSize().width(), s.width(), box->item->maximumSize().width()); a[i].sizeHint = a[i].minimumSize = - box->item->heightForWidth(s.width()); + box->item->heightForWidth(width); + } } } |