Is there a way to create a completely new window instance, as a child window of the main QML window in a QmlApplication?
// ChildWindow.qml
Rectangle {
id: childWindow
width: 100
height: 100
// stuff
}
// main.qml
Rectangle {
id: window
width: 1000
height: 600
MouseArea {
anchors.fill: parent
onClicked: createAWindow(childWindow);
}
}
I am trying to avoid writing a Q_OBJECT
class just for instanciating the new window within a new QmlApplicationViewer
.
There is no way to create top-level windows using only built-in QML functionality.
However there's a project on Qt Labs called Desktop Components, which among other things contains a Window component, which allows you to create new top-level windows.