Just an idea of how to achieve this behavior. See the Window QML class and creating dynamic objects to actually create a window on demand.
Some (UNTESTED) pseudo-code, just to give the idea of "DockWindow.qml":
import QtQuick 2.0 import QtQuick.Window 2.2 Rectangle { id: dockWidget property Window window: null property Item embedIn: null parent: window ? window : embedIn readonly property bool detached: window function detach() { if (!window) { window = Qt.createQmlObject(' import QtQuick.Window 2.2 Window { flags: …; } ', dockWidget, "dockWidget"); } } function close() { if (window) { window.close(); } } }
Note. This code will not work out of the box and will probably lead to a dependency loop for the "parent" property!
Nils fenner
source share