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>
This commit is contained in:
hjk
2019-09-26 11:32:20 +02:00
parent 08149a7c34
commit 4323da700a

View File

@@ -940,12 +940,10 @@ void PerspectivePrivate::restoreLayout()
qCDebug(perspectivesLog) << "PERSPECTIVE STATE AVAILABLE BY FULL ID."; qCDebug(perspectivesLog) << "PERSPECTIVE STATE AVAILABLE BY FULL ID.";
} }
if (state.isEmpty()) { // The order is important here: While QMainWindow can restore layouts with
qCDebug(perspectivesLog) << "PERSPECTIVE " << m_id << "RESTORE NOT POSSIBLE, NO STORED STATE"; // not-existing docks (some placeholders are used internally), later
} else { // replacements with restoreDockWidget(dock) trigger a re-layout, resulting
bool result = theMainWindow->restoreState(state); // in different sizes. So make sure all docks exist first before restoring state.
qCDebug(perspectivesLog) << "PERSPECTIVE " << m_id << "RESTORED. SUCCESS: " << result;
}
qCDebug(perspectivesLog) << "PERSPECTIVE" << m_id << "RESTORING LAYOUT FROM " << settingsId(); qCDebug(perspectivesLog) << "PERSPECTIVE" << m_id << "RESTORING LAYOUT FROM " << settingsId();
for (DockOperation &op : m_dockOperations) { for (DockOperation &op : m_dockOperations) {
@@ -958,6 +956,13 @@ void PerspectivePrivate::restoreLayout()
<< (active == op.visibleByDefault ? "DEFAULT USER" : "*** NON-DEFAULT USER"); << (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() void PerspectivePrivate::saveLayout()