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. Stackview Push and Pop destroys and creates a new page
Forum Updated to NodeBB v4.3 + New Features

Stackview Push and Pop destroys and creates a new page

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 199 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.
  • G Offline
    G Offline
    Gunkut
    wrote on last edited by
    #1

    Hello, I have many pages and when a button is clicked I make transitions between these pages with a StackView, push and pop. And in these pages when corresponding buttons are clicked I make these buttons red. However, when I pop and re-opened the same page with a push, button is no longer red. So that makes me think that pop and push destroys and creates a new page which is the opposite what is written in docs: This means that any item pushed onto a StackView will never be destroyed by the StackView; only items that StackView creates from Components or URLs are destroyed by the StackView.

    Here is the code for stackview:

    Window{
       id:main
       property bool isAbsOffRoad: false
       StackView{
          id:contentFrame
          initialItem:Qt.resolvedUrl("qrc:/MainPage.qml")
          Connections{
             target:contentFrame.currentItem
             onBackButtonPressed:{
                contentFrame.pop() }
             }}
    

    And then here is how I push:

    Item {
       id:backgroundItem
       LeftButtons{
          id:buttonSettings
          MultiPointTouchArea{
             onPressed{
                contentFrame.push("qrc:/SettingsPage.qml")}
    }}
    

    I cannot see a reason why the page doesn't preserves it's state when popped and pushed back. What might be the reason?

    Another question is: I get a QML Connections: Cannot assign to non-existent property "onBackButtonPressed". However, back buttons work. Why I get that error?
    Kind regards.

    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