Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QML Page Transition
Forum Updated to NodeBB v4.3 + New Features

QML Page Transition

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 250 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    ceydasimsekk
    wrote on last edited by
    #1

    Hello, I want to make an efficient transition between my QML pages. I tried this method but it's too slow and closing the view causes a bad transition. How can I achieve this?

    ApplicationWindow{
    id:screen
    color:"white"
    width: Screen.width
    height:Screen.height
    visible:true

    StackView{
        id:stackView
        anchors.fill:parent
        initialItem: loginPage 
    
    }
    
    Component{
        id:loginPage
        Item {
            width: parent.width
            height: parent.height
    
            // 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
                // Butonun tıklanabilir alanını tanımlar
                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") {
        
    
                            stackView.push(Qt.resolvedUrl("qrc:/qml/MainRootWindow.qml"))
                            screen.visible=false
                        } else {
                            // Hatalı giriş mesajı
                            errorMessage.text = "kullanıcı adı veya şifre yanlış!"
                            errorMessage.visible = true
                        }
                    }
                }
    
    1 Reply Last reply
    0
    • A Offline
      A Offline
      Anumas
      wrote on last edited by
      #2

      Why are you closing the view, then? I don't think you need to. Instead of closing it, replace the current item in the StackView (like you do in stackView.push(Qt.resolvedUrl("qrc:/qml/MainRootWindow.qml"))) . So remove this screen.visible=false

      By default, StackView implements different transition for different events like popEnter, pushExit, ect. Here's an example of how to implement your own transitions: https://doc.qt.io/qt-6/qtquickcontrols-customize.html#customizing-stackview

      Say hello to a bright day.-

      Anumas.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved