This patch explores a mechanism that allows users to detach ("float") dock widget views as regular/standalone windows instead of as Qt::Tool windows, and extends the API to make this behaviour default.
The current approach achieves this by reparenting the widget of an already floated view away from its parent, as discussed on the ML. It makes sure there are no direct consequences of this (adds NULL checks for m_area and m_view where needed) and caches the original parent in a state variable so that the window can be reattached.
By default, the "regular detach window" option is provided as an additional option in the "Toolview position" menu. (See test plan.)
Detached standalone windows are reattached and docked on application shutdown as a precaution and to prevent them from being restored as Qt::Tool windows when the application is restarted (as far as I can tell we cannot prevent that or even rectify it post-hoc). See also test plan.
An API is provided allowing clients to indicate that views should be floated as standalone windows: a private state variable with getter and setter, plus an overload for QDockWidget::setFloating(). Setting this option removes that "Detached as floating window" menu action and causes "tearing off" to give the desired window type. This API extension requires exporting IdealDockWidget.
This might be proposed for upstreaming: support for regular detached windows is a lot easier to implement in QDockWidget (cf. https://bugreports.qt.io/browse/QTBUG-63774). Alternatively upstreaming could also target KWidgetsAddons (KDockWidget).
Reparenting the detached view means the dock widget itself is left empty, which is why the patch closes it. Reparenting also provokes a change in window position. It doesn't really bother me when using the "detach as standalone" menu action but it's a bit surprising when it happens while "tearing off" a view. Ideas welcome how to prevent this.
The class is now tested in the test_viewactivation unittest, which requires exporting the IdealController class as well. The test is currently very basic, and cannot yet test standalone floating mode properly because IdealController::raiseView crashes (m_view_to_action.value(view) returns NULL). The test succeeds when I remove the m_area->raiseToolView(m_view) call from IdealDockWidget::makeStandaloneWindow().