Dock widgets: Add collapse/uncollapse functionality

Add a button that can be used to collapse a dock widget's contents
temporarily, as an alternative to removing and re-adding it.

To achieve that, remove the inner widget of the dock widget and store it
in an inner pointer. Just setting the inner widget invisible/visible
does not work, because the title widget of a dock widget with invisible
inner widget becomes 0 for some reason. We also need to add a dummy
widget with a maximum height, to make the dock widget resize and not be
resizable afterwards.

Do not allow collapsing if the dock is the only one in the area, in a
horizontal layout, floating, or tabbed.

Change-Id: Ibc1acb59d58069f08184e65c4814642acb0028ee
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
Eike Ziller
2023-11-09 15:33:11 +01:00
parent cd6311a125
commit 09f43e79cf
3 changed files with 96 additions and 2 deletions

View File

@@ -1004,7 +1004,7 @@ void PerspectivePrivate::restoreLayout()
if (state.mainWindowState.isEmpty()) {
qCDebug(perspectivesLog) << "PERSPECTIVE " << m_id << "RESTORE NOT POSSIBLE, NO STORED STATE";
} else {
bool result = theMainWindow->restoreState(state.mainWindowState);
bool result = theMainWindow->restoreFancyState(state.mainWindowState);
qCDebug(perspectivesLog) << "PERSPECTIVE " << m_id << "RESTORED, SUCCESS: " << result;
}