From 41437f55f911b32d17ed153a14eb1b1673f17c86 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Mon, 8 Mar 2010 14:07:32 +0100 Subject: Fix undocked widgets not being restored correctly as part of the layout Task-number: QTBUG-7921 Reviewed-by: ogoffart --- src/gui/widgets/qdockarealayout.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/gui/widgets/qdockarealayout.cpp b/src/gui/widgets/qdockarealayout.cpp index 0c39f42..794863b 100644 --- a/src/gui/widgets/qdockarealayout.cpp +++ b/src/gui/widgets/qdockarealayout.cpp @@ -1990,16 +1990,19 @@ bool QDockAreaLayoutInfo::restoreState(QDataStream &stream, QList #ifdef QT_NO_TABBAR const int tabBarShape = 0; #endif - QDockAreaLayoutInfo *info = new QDockAreaLayoutInfo(sep, dockPos, o, - tabBarShape, mainWindow); - QDockAreaLayoutItem item(info); + QDockAreaLayoutItem item(new QDockAreaLayoutInfo(sep, dockPos, o, + tabBarShape, mainWindow)); stream >> item.pos >> item.size >> dummy >> dummy; - if (!info->restoreState(stream, widgets, testing)) + //we need to make sure the element is in the list so the dock widget can eventually be docked correctly + if (!testing) + item_list.append(item); + + //here we need to make sure we change the item in the item_list + QDockAreaLayoutItem &lastItem = testing ? item : item_list.last(); + + if (!lastItem.subinfo->restoreState(stream, widgets, testing)) return false; - if (!testing) { - item_list.append(item); - } } else { return false; } -- cgit v0.12