there is no something different, in the same button , the fisrt click load the file qml , but when i close it and try to load it again it dosen't work
there is no something different, in the same button , the fisrt click load the file qml , but when i close it and try to load it again it dosen't work
When you close what?
There is nothing in your code that indicates closing.
All there seems to be is a loader and it gets its source property set to a single specific value.
Cheers,
_
when i close the file2.qml , it is an application window , so i can close it , but when i click in the button to reload it it doesn't work
Why would it work? The loader still refers to the same file. The window is just closed.
You can you this solution ,it will be useful for you
Rectangle {
....
Button{
id:btnAddTile
text: qsTr("Add new tile")
width: 90
height: 25
anchors.horizontalCenter: parent.horizontalCenter
onClicked: {
var component = Qt.createComponent("File2.qml");
if (component.status === Component.Ready)
component.createObject(parent, {"x": 100, "y": 100});
}
}
}
File2.qml :
ApplicationWindow {
.....
}
Yes wysota exactly , that was my question
rayan what is the diffrence between using laoder and using createComponent ?
with createComponent your problem is resolved , so you can click on your button as far as to want
Bookmarks