Yuchen Deng
2014-06-01 11:25:42 UTC
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
parent.
Any help / tips are very welcome!
Thanks you!
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.qmlimport 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();
}
}
}
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 inimport 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"
}
}
}
parent.
Any help / tips are very welcome!
Thanks you!
--
Best Regards
Yuchen
Best Regards
Yuchen