I tried to develop UI in QML. The development environment is embedded. This environment spends a lot of time to boot. So, Tries to use the following method with Loader element.
//Main.qml
Rectangle {
width: 800; height: 600; color:"blue"
Column{
width: parent.width; height: parent.height
Row{
width:parent.width; height:parent.height*0.2
Rectangle{
id: runButton
width: parent.width*0.2; height: parent.height*0.8
color: "red"
Text{
text: "RUN"; color:"white"; font.pointSize: 20; anchors.centerIn: parent
}
MouseArea{
anchors.fill: parent
onClicked: {
readyGO.source= "./test3.qml"
}
}
}
Rectangle{
id: quitButton
width: parent.width*0.2
height: parent.height*0.8
color: "green"
Text{
text: "Quit"
color: "white"
font.pointSize: 30
anchors.centerIn: parent
}
MouseArea{
anchors.fill: parent
onClicked: {
testMain.source= ""
}
}
}
}
Rectangle{
width: parent.width*0.8
height: parent.height*0.8
anchors.horizontalCenter: parent.horizontalCenter
Loader{
id: testMain
}
}
}
}
// test3.qml
Rectangle {
id: rect
width: 360
height: 360
Text {
anchors.centerIn: parent
text: "~~~~~~~~~~~~asfsdfas~~~" // changing contents -> "Hello"
}
}
and then, The contents of the file(test3.qml) have changed.
But, After fixing the contents of the file is not applied.
Could you tell men How to reload a changing qml File?
↧