Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. How to iterate "parent" objects?
Forum Updated to NodeBB v4.3 + New Features

How to iterate "parent" objects?

Scheduled Pinned Locked Moved Unsolved C++ Gurus
4 Posts 3 Posters 465 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.
  • A Offline
    A Offline
    Anonymous_Banned275
    wrote on 2 May 2024, 18:22 last edited by Anonymous_Banned275 5 Feb 2024, 18:24
    #1
    This post is deleted!
    1 Reply Last reply
    0
    • A Offline
      A Offline
      Axel Spoerl
      Moderators
      wrote on 4 May 2024, 08:56 last edited by
      #2

      I am not entirely sure, what you mean by "iterating through the parents". A widget only has one parent. A tree node has no parent, if it's the root node and it has no children, if it's a leaf.
      So which parents do you want to iterate through. If you mean the siblings of a node's parent, just find all children of the grandparent.

      Software Engineer
      The Qt Company, Oslo

      1 Reply Last reply
      1
      • A Offline
        A Offline
        Anonymous_Banned275
        wrote on 8 May 2024, 22:57 last edited by
        #3
        This post is deleted!
        1 Reply Last reply
        0
        • C Online
          C Online
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on 9 May 2024, 06:39 last edited by
          #4

          To access the grandparent use parent()->parent()

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          1
          • C Christian Ehrlicher referenced this topic on 9 May 2024, 19:11

          1/4

          2 May 2024, 18:22

          • Login

          • Login or register to search.
          1 out of 4
          • First post
            1/4
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved