summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets/qdockarealayout.cpp
diff options
context:
space:
mode:
authorDebao Zhang <dbzhang800@gmail.com>2011-12-25 00:47:41 +0800
committerQt by Nokia <qt-info@nokia.com>2012-02-23 10:14:24 +0100
commitd2f65aa470fe30849a01380e4a50e8a4ebbce07e (patch)
treec8e74ca01a820ed7a384b3eac27f65a627bc7687 /src/widgets/widgets/qdockarealayout.cpp
parentef9a86db5615a438c72a78745a8e558e687bf829 (diff)
Fix conflict between QMainWindow::restoreState() and QWidget::setStylesheet()
If QMainWindow::restoreState() then QWidget::setStylesheet() were called before the QMainWindow is shown, the size of QDockWidget can not be restored. QWidget::setStylesheet() will generate QEvent::StyleChange event, which will cause the function QDockAreaLayout::fitLayout() to be called before the layout of MainWindow is activated. Although the state info has been stored in a QMainWindowLayoutState variable by QMainWindow::restoreState(), but QMainWindowLayout::setGeometry() still isn't called at present. So QDockAreaLayout::fitLayout() will force the size of dockwidgets and centralwidget to be calculated using the wrong geometry, which will break the state restored by QMainWindow::restoreState(). This is a side effect of 692e9103ebb85b90e79377206d5d03b704d43d42. Task-number: QTBUG-15080 Change-Id: I8cda6a529d178f7467a59b780db80df0a44d4769 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'src/widgets/widgets/qdockarealayout.cpp')
-rw-r--r--src/widgets/widgets/qdockarealayout.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/widgets/widgets/qdockarealayout.cpp b/src/widgets/widgets/qdockarealayout.cpp
index df083ccbfe..a07ab73ad0 100644
--- a/src/widgets/widgets/qdockarealayout.cpp
+++ b/src/widgets/widgets/qdockarealayout.cpp
@@ -3321,7 +3321,8 @@ void QDockAreaLayout::keepSize(QDockWidget *w)
void QDockAreaLayout::styleChangedEvent()
{
sep = mainWindow->style()->pixelMetric(QStyle::PM_DockWidgetSeparatorExtent, 0, mainWindow);
- fitLayout();
+ if (isValid())
+ fitLayout();
}
QT_END_NAMESPACE