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. Application Architecture (StackView)
Forum Updated to NodeBB v4.3 + New Features

Application Architecture (StackView)

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 3 Posters 1.4k 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.
  • D Offline
    D Offline
    Duff
    wrote on last edited by
    #1

    Hi there,

    I have been happily coding along making a navigation system for my application using a ListView. As I choose items from the list and need to load different data I am changing the model of the list programatically. So I really only ever have one ListView and the model just keeps changing. Now I am embarking on the task of keeping track of a stack of model id's so that I can move back and forth in the navigation system.

    I see that StackView is a nice implementation of such a scenario. I cant decide if I should create several different ListViews and add them to a StackView for navigation or if I should just keep track of models within my one ListView. The only reason I can think of to stick with the one ListView is to conserve memory. Do you think that makes sense? Hard to say how many different ListViews I will ultimately need if I decide to go that way. Maybe 15 or 20 at the most.

    Any thoughts?

    Thanks

    Brian

    --Duff

    1 Reply Last reply
    0
    • O Offline
      O Offline
      onek24
      wrote on last edited by
      #2

      Hey,

      so what i did understand is that you need multiple models, right? Well i would recomment you to create one custom model in Cpp and pass it to QML.

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jryannel
        wrote on last edited by
        #3

        Hmmm,

        You can use the StackView and re-use the same ListView over and over again if you want. When pushing a item onto the stack you can pass in arguments.

        See http://qt-project.org/doc/qt-5.1/qtquickcontrols/qml-qtquick-controls1-stackview.html section Pushing Items

        One argument could be the a reference to the model to be loaded. values in the properties argument the are applied on construction of the list view.

        Back is then automatically handled using pop() (selection preservation). The overhead in memory is to have all stacked list views in memory. If a list view is popped it will be destroyed.

        Also having these 20 different list view as separate files or components inside your project.

        If you need a C++ model, depends where your data comes from.

        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