Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. How to change the page in QML?
Forum Updated to NodeBB v4.3 + New Features

How to change the page in QML?

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
3 Posts 2 Posters 2.7k Views 1 Watching
  • 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.
  • S Offline
    S Offline
    Saeed_Nowroozi
    wrote on last edited by
    #1

    Hi,
    I have a lot of QML pages and the page has to be changed every time I press the button. Pages can be moved forward or back to the previous page. I used StackView , but this do not correct. When push button , new page overlap on base page and just work for one page. what is your suggestion?

    StackView {
    id: stackView
    initialItem: "HomeForm.ui.qml"
    anchors.fill: parent
    }
    Drawer {
    id: drawer
    }
    ItemDelegate {
    x: 0
    y: 2
    // text: qsTr("Page 1")
    width: parent.width
    Button {
    id: button
    x: 265
    y: 351
    text: qsTr("Button")

               //      anchors.fill: parent
                onClicked: {
                    stackView.push("Page1Form.ui.qml")
                    drawer.close()
                }
            }
        }
        }
    

    b2.PNG b1.PNG

    ODБOïO 1 Reply Last reply
    0
    • S Saeed_Nowroozi

      Hi,
      I have a lot of QML pages and the page has to be changed every time I press the button. Pages can be moved forward or back to the previous page. I used StackView , but this do not correct. When push button , new page overlap on base page and just work for one page. what is your suggestion?

      StackView {
      id: stackView
      initialItem: "HomeForm.ui.qml"
      anchors.fill: parent
      }
      Drawer {
      id: drawer
      }
      ItemDelegate {
      x: 0
      y: 2
      // text: qsTr("Page 1")
      width: parent.width
      Button {
      id: button
      x: 265
      y: 351
      text: qsTr("Button")

                 //      anchors.fill: parent
                  onClicked: {
                      stackView.push("Page1Form.ui.qml")
                      drawer.close()
                  }
              }
          }
          }
      

      b2.PNG b1.PNG

      ODБOïO Offline
      ODБOïO Offline
      ODБOï
      wrote on last edited by
      #2

      hi

      @Saeed_Nowroozi said in How to change the page in QML?:

      but this do not correct. When push button , new page overlap on base page

      that is the normal behavior of the stackView, you can push pages to it and it will stack them. You can also decide to remove (pop()) one page before you push a new one. See here everithing you can do https://doc.qt.io/qt-5/qml-qtquick-controls2-stackview.html#methods

      see also
      https://doc.qt.io/qt-5/qml-qtquick-controls2-swipeview.html

      S 1 Reply Last reply
      3
      • ODБOïO ODБOï

        hi

        @Saeed_Nowroozi said in How to change the page in QML?:

        but this do not correct. When push button , new page overlap on base page

        that is the normal behavior of the stackView, you can push pages to it and it will stack them. You can also decide to remove (pop()) one page before you push a new one. See here everithing you can do https://doc.qt.io/qt-5/qml-qtquick-controls2-stackview.html#methods

        see also
        https://doc.qt.io/qt-5/qml-qtquick-controls2-swipeview.html

        S Offline
        S Offline
        Saeed_Nowroozi
        wrote on last edited by
        #3

        @LeLev Thanks

        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