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. Get all children QTreeview / QStandardItemModel
Forum Updated to NodeBB v4.3 + New Features

Get all children QTreeview / QStandardItemModel

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 1.9k 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.
  • K Offline
    K Offline
    kumararajas
    wrote on last edited by kumararajas
    #1

    Hello

    I have tree like this -

    +Parent1
          + Child10
           - Child11
              - GrandChild110
              - GrandChild111
              - GrandChild112
    +Parent2
          + Child20
           - Child21
               - GrandChild210
               - GrandChild211
               - GrandChild212
    

    I would like to write function something like, based on parent, I want to get first level of children.

    Example, In the above example, children of Parent1 is

    +Parent1
          + Child10
           + Child11
    

    I want to get them alone.
    Children of Child21 are

           - Child21
               - GrandChild210
               - GrandChild211
               - GrandChild212
    

    How do I achieve this in a neat straight forward way?

    Thanks,
    Kumara

    --Kumar

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Do you mean filter out children lower than one level under Parent ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      K 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        Do you mean filter out children lower than one level under Parent ?

        K Offline
        K Offline
        kumararajas
        wrote on last edited by
        #3

        @SGaist Yes, correct Sam. Should I need to use proxy filters?

        --Kumar

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          That's a good start for filtering yes. The QSortFilterProxyModel might be a good starting point.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • K Offline
            K Offline
            kumararajas
            wrote on last edited by
            #5

            Thank you!

            --Kumar

            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