diff options
author | hjk <hjk@qt.io> | 2019-09-26 11:32:20 +0200 |
---|---|---|
committer | hjk <hjk@qt.io> | 2019-09-26 12:06:19 +0000 |
commit | 4323da700ad31f11031d56969358e0dde9357f04 (patch) | |
tree | a84782f21a6f6fcb9326a30e6a47ac7a6d85c767 | |
parent | 08149a7c348a3947352b92e0d5b6c44c0a2453e8 (diff) |
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 <eike.ziller@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
-rw-r--r-- | src/plugins/debugger/debuggermainwindow.cpp | 17 |
1 files 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() |