summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets/qdockarealayout.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/widgets/qdockarealayout.cpp')
-rw-r--r--src/gui/widgets/qdockarealayout.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/gui/widgets/qdockarealayout.cpp b/src/gui/widgets/qdockarealayout.cpp
index f44858a..806654c 100644
--- a/src/gui/widgets/qdockarealayout.cpp
+++ b/src/gui/widgets/qdockarealayout.cpp
@@ -1995,16 +1995,19 @@ bool QDockAreaLayoutInfo::restoreState(QDataStream &stream, QList<QDockWidget*>
#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;
}