summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qwidget.cpp
diff options
context:
space:
mode:
authorJan-Arve Sæther <jan-arve.saether@nokia.com>2009-10-20 11:04:56 (GMT)
committerJan-Arve Sæther <jan-arve.saether@nokia.com>2009-10-20 14:25:24 (GMT)
commitaf17ea048179ea0c21a897f803e79f825a9d13b6 (patch)
treec886de07268e9fa33c65cdb67256e87da1f35058 /src/gui/kernel/qwidget.cpp
parent856efef9bf87e0b7e5ed6ad2ccb225e294321888 (diff)
downloadQt-af17ea048179ea0c21a897f803e79f825a9d13b6.zip
Qt-af17ea048179ea0c21a897f803e79f825a9d13b6.tar.gz
Qt-af17ea048179ea0c21a897f803e79f825a9d13b6.tar.bz2
Make adjustSize work even if there is a pending LayoutRequest event.
The original report was that the customer did resize(main.sizeHint()) instead of the main.adjustSize(); Note that resize(main.sizeHint() still does not work. However, calling main.adjustSize() should now do what the original reporter wanted. The problem was that the resize did not work, because at the point of the resize the minimumHeight of main was still 22 (8+6+8), and we tried to resize it with a new height of 10. The resize would bound the height up to 22, and the main widget would then get a size of (200x22). The reason why it still had a minimumHeight of 22 was that it was the minimumSize of the previous layout configuration. Unfortunately the new minimumSize of the widget hadn't been updated yet because there was a LayoutRequest event in the queue that hadn't been processed yet. (This LayoutRequest was triggered by that we called invalidate() from hide()). Thus, processing the event queue immediately after the hide() could also have been a workaround for this issue. There is no really good fix for this issue (and it does not seem to be a common problem) without introducing a risk for regressions. Due to that we therefore decided to provide a fix in QWidget::adjustSize(). Reviewed-by: paul
Diffstat (limited to 'src/gui/kernel/qwidget.cpp')
-rw-r--r--src/gui/kernel/qwidget.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 7dc3ae9..64b18ce 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -7726,6 +7726,10 @@ void QWidget::adjustSize()
Q_D(QWidget);
ensurePolished();
QSize s = d->adjustedSize();
+
+ if (d->layout)
+ d->layout->activate();
+
if (s.isValid())
resize(s);
}