What is the most efficient way to switch between QML pages in my QGroundControl project? I did it with the Loader class, but the migration is very slow and inefficient.
Loader {
id: dynamicLoader
anchors.fill: parent
visible: false
}
// Buton
Rectangle {
id: startButtonContainer
width: parent.width * 0.1
height: 50
color: “#388E3C”
radius: 20
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: passwordFieldContainer.bottom
anchors.topMargin: 40
MouseArea {
anchors.fill: parent
onClicked: {
if(usernameField.text === “” || passwordField.text === “”){
errorMessage.text = “kullanıcı adı veya şifre boş bırakılamaz!”
errorMessage.visible = true
}
else if (usernameField.text === “cnş” && passwordField.text === “1234”) {
dynamicLoader.source = “qrc:/qml/MainRootWindow.qml”
dynamicLoader.visible = true
screen.visible = false
} else {
// Hatalı giriş mesajı
errorMessage.text = “kullanıcı adı veya şifre yanlış!”
errorMessage.visible = true
}
}
}