From 4323da700ad31f11031d56969358e0dde9357f04 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 26 Sep 2019 11:32:20 +0200 Subject: Debugger: Try harder to restore dock widget sizes This is bit of a hack: The dock widget sizes were actually restored but when previously non-existing docks were affected, a re-layout was triggered, resulting in different sizes. This can be avoided by instantiating all dock first. Fixes: QTCREATORBUG-22415 Change-Id: I4c0b27f5bab5864e93e303db758d8b909a51a425 Reviewed-by: Eike Ziller Reviewed-by: Christian Stenger --- src/plugins/debugger/debuggermainwindow.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/plugins/debugger/debuggermainwindow.cpp b/src/plugins/debugger/debuggermainwindow.cpp index e13d18e87f..70641b4a37 100644 --- a/src/plugins/debugger/debuggermainwindow.cpp +++ b/src/plugins/debugger/debuggermainwindow.cpp @@ -940,12 +940,10 @@ void PerspectivePrivate::restoreLayout() qCDebug(perspectivesLog) << "PERSPECTIVE STATE AVAILABLE BY FULL ID."; } - if (state.isEmpty()) { - qCDebug(perspectivesLog) << "PERSPECTIVE " << m_id << "RESTORE NOT POSSIBLE, NO STORED STATE"; - } else { - bool result = theMainWindow->restoreState(state); - qCDebug(perspectivesLog) << "PERSPECTIVE " << m_id << "RESTORED. SUCCESS: " << result; - } + // The order is important here: While QMainWindow can restore layouts with + // not-existing docks (some placeholders are used internally), later + // replacements with restoreDockWidget(dock) trigger a re-layout, resulting + // in different sizes. So make sure all docks exist first before restoring state. qCDebug(perspectivesLog) << "PERSPECTIVE" << m_id << "RESTORING LAYOUT FROM " << settingsId(); for (DockOperation &op : m_dockOperations) { @@ -958,6 +956,13 @@ void PerspectivePrivate::restoreLayout() << (active == op.visibleByDefault ? "DEFAULT USER" : "*** NON-DEFAULT USER"); } } + + if (state.isEmpty()) { + qCDebug(perspectivesLog) << "PERSPECTIVE " << m_id << "RESTORE NOT POSSIBLE, NO STORED STATE"; + } else { + bool result = theMainWindow->restoreState(state); + qCDebug(perspectivesLog) << "PERSPECTIVE " << m_id << "RESTORED, SUCCESS: " << result; + } } void PerspectivePrivate::saveLayout() -- cgit v1.2.1