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. Need help deciding how to do things with listview
Forum Updated to NodeBB v4.3 + New Features

Need help deciding how to do things with listview

Scheduled Pinned Locked Moved QML and Qt Quick
qt quickqmllistview
5 Posts 2 Posters 1.5k 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.
  • F Offline
    F Offline
    flashmozzg
    wrote on last edited by
    #1

    In my app I have a linked block/list like structure. (blocks follow one after another but can also contain lists of the same blocks inside themselves). They have different properties. I want to be able to add them and the edit they properties when I , for example, press on them. I made the structure in C++ but I don't know how to represent it in qml listview or something else. To put it simply I want model/something that can show block of different types with different properties that I can modify if I select them and that I can append to my model. Also there will be special blocks that will be able to contain more blocks in them,

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Sounds more like a tree than a list.
      You could separate the structure of the whole thing from the structure of a single block. The blocks would be represented in a tree and after clicking on a block you could list (and edit) the properties in a separate list.

      F 1 Reply Last reply
      0
      • Chris KawaC Chris Kawa

        Sounds more like a tree than a list.
        You could separate the structure of the whole thing from the structure of a single block. The blocks would be represented in a tree and after clicking on a block you could list (and edit) the properties in a separate list.

        F Offline
        F Offline
        flashmozzg
        wrote on last edited by
        #3

        @Chris-Kawa Well, I'm on 5.4.1 and there is no tree view yet (I heard it will be in 5.5) so.. I mean I have the structure in my c++ files I just don't know how to properly represent/draw them in qml.

        1 Reply Last reply
        0
        • Chris KawaC Offline
          Chris KawaC Offline
          Chris Kawa
          Lifetime Qt Champion
          wrote on last edited by
          #4

          You can search the forum for qml treeviews. There's been some discussions about this in the past and some custom implementations presented. You might find something suiting you.

          Some related topics or resources:
          http://forum.qt.io/topic/50743/wip-c-qml-fully-recursive-treeview
          http://www.codeproject.com/Articles/664041/QML-QtQuick-TreeView-Model-Part-II
          https://www.qtdeveloperdays.com/sites/default/files/north-america/QtQuickTreeView.pdf

          F 1 Reply Last reply
          0
          • Chris KawaC Chris Kawa

            You can search the forum for qml treeviews. There's been some discussions about this in the past and some custom implementations presented. You might find something suiting you.

            Some related topics or resources:
            http://forum.qt.io/topic/50743/wip-c-qml-fully-recursive-treeview
            http://www.codeproject.com/Articles/664041/QML-QtQuick-TreeView-Model-Part-II
            https://www.qtdeveloperdays.com/sites/default/files/north-america/QtQuickTreeView.pdf

            F Offline
            F Offline
            flashmozzg
            wrote on last edited by
            #5

            @Chris-Kawa
            Thanks.

            Btw, is there a way to make something OO like in qml? I mean from my point of view I have a bunch of objects with different properties, some of then even contain another such objects. And I'd want to be able to draw all of them with these properties but all delegate/role models imply that I have some common set of properties which is not the case. Isn't there a way to "bind" some c++ qt object to it's proper qml representation stating how it should be drawn?
            For example, If I have object with int foo and QString bar property I'd like it to be drawn as Rectangle with foo and bar displayed inside of it.
            And if I have object wich is a "node" i'd like to draw it as the on above but with all children to the right or inside.

            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