Core: Add a way to delay-construct mode widgets

... and use it for edit mode.

There's currently no real effect as the mode bar population in
ModeManagerPrivate::extensionsInitializedHelper() accesses all
IMode::widget() and triggers the creation, but in principle we
could pass the functor instead of the widget down to and store in
FancyTabWidget and only use it when a mode gets activated.

Change-Id: I4c4a276bc025abce1ff47c68b060c67b5c8e5170
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
hjk
2024-07-08 11:05:38 +02:00
parent 6c39e136fd
commit 1c17370146
4 changed files with 22 additions and 9 deletions

View File

@@ -500,13 +500,11 @@ public:
setPriority(85);
setId(MODE_DEBUG);
setWidget(new DebugModeWidget);
setWidgetCreator([] { return new DebugModeWidget; });
setMainWindow(DebuggerMainWindow::instance());
setMenu(&DebuggerMainWindow::addPerspectiveMenu);
}
~DebugMode() { delete widget(); }
};
///////////////////////////////////////////////////////////////////////