What do you mean by sub window? If you mean you are trying to create an MDI interface, with a window acting as a desktop and having more windows inside, that's not supported in Qt Quick and is unlikely at this point, since the widgets implementation turned out to be quite bug-prone, and MDI has anyway mostly fallen out of fashion. When you declare a Window inside a Window, it becomes "transient for" the outer window: a hint is given to the window manager that they are related to each other, so usually it will be shown centered over its transient parent.
On 1 Jun 2014, at 1:25 PM, Yuchen Deng wrote: > hi, list! I have to ask for help because I can't create an sub window on > Window {...}. > I've tried some days, after Google still can't solved my problem. > > main.qml > import QtQuick 2.2 > import QtQuick.Window 2.1 > Window { > id: mainWindow > visible: true > width: 760; height: 520 > color: "red" > property variant win; // you can hold this as a reference.. > Text { > text: "Click here to open sub window 2!" > anchors.centerIn: parent > } > Window { > id: subWindow_1 > width: 555 > height: 333 > visible: true > flags: Qt.SubWindow > } > MouseArea { > anchors.fill: parent > onClicked: { > var component = Qt.createComponent("subwindow2.qml"); > win = component.createObject(mainWindow); > win.show(); > } > } > } > > subwindow2.qml > import QtQuick 2.2 > import QtQuick.Window 2.1 > Window { > id: subWindow_2 > visible: true > width: 500; height: 300 > color: "blue" > flags: Qt.SubWindow > Rectangle { > anchors.fill: parent > color: "lightGrey" > Text { > anchors.centerIn: parent > text: "Sub Window 2" > } > } > } > > > See the code, it's can open two window, But can't open as sub window in > parent. > Any help / tips are very welcome! > Thanks you! > -- > Best Regards > Yuchen > _______________________________________________ > Interest mailing list > Interest@qt-project.org > http://lists.qt-project.org/mailman/listinfo/interest _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest