Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Using loader how to save the components and not destroy them
Forum Updated to NodeBB v4.3 + New Features

Using loader how to save the components and not destroy them

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 286 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.
  • M Offline
    M Offline
    Mandeep.Chaudhary
    wrote on last edited by Mandeep.Chaudhary
    #1

    Currently, I am navigating from one page to another in QML using Loader.
    In this application example let us assume we have two qml files main and second .qml .

    One can navigate from main.qml to second.qml and vice versa by simply changing Loader.source. Current problem with this approach is that as soon as loader source is changed the component is destroyed and on revisiting the page the component is created again.

    I am looking for some way in which i can save this component in that state. Basically android back button does that for android apps.

    In this example i have two buttons in main.qml i.e. back and create. If i click on create button it will create the new component of second.qml and app will be directed to it. If I click on back button from main.qml then if second.qml has been visited before it will open that instance of second.qml which is somehow saved when first time second.qml was redirected to main.qml.

    I want to have both the options i.e. create a new component and revisiting the component in previous state via loader.

    Thank You

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Use StackView. It's simple and works just like you want it to.

      There is also SwipeView and TabBar, if your needs are different. See the docs.

      (Z(:^

      1 Reply Last reply
      1

      • Login

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