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. Best way to manage multiple random screens in a single window
Forum Updated to NodeBB v4.3 + New Features

Best way to manage multiple random screens in a single window

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
5 Posts 3 Posters 370 Views 2 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.
  • T Offline
    T Offline
    therealmatiss
    wrote on last edited by
    #1

    Hello!

    I was wondering about the best way to manage multiple screens that are interconnected very vaguely between each other.

    For example, there's main.qml, item1.qml, item2.qml, item3.qml and basically from any screen I should be able to reach any other screen.
    Ex. main -> item1 -> item3 -> main -> item2 -> item1 -> main

    So far I have been using Stackview but it's obviously not for my use case. I am thinking about Loader - but I don't understand - does it always keep loaded previous screens? I mean how can I guarantee consistent load times and animations? Can I just load all screens at once in Loader and just set the current Loader.source so it won't reload? (I'm ok with longer initialization but not okay with inconsistent loading).

    Maybe something else than Loader should be used? Simple Component show/hide?

    1 Reply Last reply
    0
    • GrecKoG Offline
      GrecKoG Offline
      GrecKo
      Qt Champions 2018
      wrote on last edited by
      #2

      @therealmatiss said in Best way to manage multiple random screens in a single window:

      So far I have been using Stackview but it's obviously not for my use case.

      Why not?

      1 Reply Last reply
      0
      • T Offline
        T Offline
        therealmatiss
        wrote on last edited by
        #3

        Because I want to access stackview items that are not in order. For example, go to the middle of the stack.

        1 Reply Last reply
        0
        • fcarneyF Offline
          fcarneyF Offline
          fcarney
          wrote on last edited by fcarney
          #4

          I use a StackView with a depth of 1. I use a ListView to display buttons that select which I want displayed in the stack. When the currentIndex in the ListView changes it calls the replace function on the StactView: replace(currentItem, panemodel[ind].comp). panemodel is a list of objects with name I use for listview button objects and the component for the current view in the StackView. When replace is called I believe the old item gets destroyed. So I have only one item loaded at any time. A Loader would probably work just fine too.

          Edit: StackView has some niceties. Like having an initialItem that can be set. I set this to item 0 in my list of objects.

          Edit 2: In thinking about this. I probably should have used a Loader.

          C++ is a perfectly valid school of magic.

          1 Reply Last reply
          0
          • fcarneyF Offline
            fcarneyF Offline
            fcarney
            wrote on last edited by
            #5

            I should point out, that you could use a push instead of a replace. Then have a back button that pops the last one off to go back. So you could use it the same way except with depth instead of how I did it.

            C++ is a perfectly valid school of magic.

            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