You can split your Dialog and App into two .qml files and have something like this maybe:
File Dialog.qml:
import QtQtuick 2.0
Rectangle{
signal done()
Text{
anchors.centerIn: parent
text: "This is my dialog"
}
MouseArea{
anchors.centerIn: parent
onClicked: parent.done()
}
}
File MyApp.qml:
import QtQtuick 2.0
Rectangle{
Text{
anchors.centerIn: parent
text: "This is my app"
}
}
and main.qml:
import QtQtuick 2.0
Rectangle{
width: 640
height: 480
Dialog{
id: dialog
anchors.fill: parent
onDone: {
dialog.visible = false;
}
}
MyApp{
id: app
anchors.fill: parent
visible: !dialog.visible
}
}
↧