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. How can I choose which Item to display?
Forum Updated to NodeBB v4.3 + New Features

How can I choose which Item to display?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 3 Posters 287 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.
  • R Offline
    R Offline
    RobM
    wrote on last edited by
    #1

    I have two Item's one displays information with a GridView and the other displays the same information with a ListView. I want to keep them part of the same Component but I would like to be able to choose between one or the other depending on the circumstances. If, in the even the user is trying to display the data in what I am calling a "details page" then I want the Component to select the ListView item but otherwise it should be displayed in a GridView. What's the common way of doing this? Is it done with states and visibility or perhaps it's done with focus scopes?

    J.HilkJ 1 Reply Last reply
    0
    • 6thC6 Offline
      6thC6 Offline
      6thC
      wrote on last edited by
      #2

      There's also https://doc.qt.io/qt-5.12/qml-qt-labs-qmlmodels-delegatechooser.html - it is still in labs but we're already using this for dynamic delegates e.g.: texedit control vs label - based on modelIndex role being edit or display etc.

      1 Reply Last reply
      0
      • R RobM

        I have two Item's one displays information with a GridView and the other displays the same information with a ListView. I want to keep them part of the same Component but I would like to be able to choose between one or the other depending on the circumstances. If, in the even the user is trying to display the data in what I am calling a "details page" then I want the Component to select the ListView item but otherwise it should be displayed in a GridView. What's the common way of doing this? Is it done with states and visibility or perhaps it's done with focus scopes?

        J.HilkJ Offline
        J.HilkJ Offline
        J.Hilk
        Moderators
        wrote on last edited by
        #3

        @RobM
        There's nothing stopping your from giving your component it's on components to choose from ;)

        I personally use a Loader where I select the source at runtime.


        Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


        Q: What's that?
        A: It's blue light.
        Q: What does it do?
        A: It turns blue.

        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