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. QObject::findChildren
Forum Updated to NodeBB v4.3 + New Features

QObject::findChildren

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 4 Posters 3.7k 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.
  • Q Offline
    Q Offline
    qcoderpro
    wrote on last edited by qcoderpro
    #1

    Hi,

    What does "immediate children" mean here: https://doc.qt.io/qt-5/qobject.html#findChildren please?

    I can't understand this.
    Will you give an example that shows the different between "Qt::FindDirectChildrenOnly" and "Qt::FindChildrenRecursively"?

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #3

      Parent and children form a tree. A direct search looks only among QWidget::children(). A recursive search will also look among children() of all objects returned by the direct call.

      So for a short example:

      QMainWindow
       - QLabel
       - QLineEdit
       - QWidget
       |-- QTreeView
       |-- QSomething
      

      A direct search will return only QLabel and QLineEdit. A recursive search can return QLabel, QLineEdit, QTreeView and QSomething.

      (Z(:^

      Q 1 Reply Last reply
      2
      • Christian EhrlicherC Online
        Christian EhrlicherC Online
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #2

        A widget has a layout and therefore can contain other widgets itself.

        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
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #3

          Parent and children form a tree. A direct search looks only among QWidget::children(). A recursive search will also look among children() of all objects returned by the direct call.

          So for a short example:

          QMainWindow
           - QLabel
           - QLineEdit
           - QWidget
           |-- QTreeView
           |-- QSomething
          

          A direct search will return only QLabel and QLineEdit. A recursive search can return QLabel, QLineEdit, QTreeView and QSomething.

          (Z(:^

          Q 1 Reply Last reply
          2
          • sierdzioS sierdzio

            Parent and children form a tree. A direct search looks only among QWidget::children(). A recursive search will also look among children() of all objects returned by the direct call.

            So for a short example:

            QMainWindow
             - QLabel
             - QLineEdit
             - QWidget
             |-- QTreeView
             |-- QSomething
            

            A direct search will return only QLabel and QLineEdit. A recursive search can return QLabel, QLineEdit, QTreeView and QSomething.

            Q Offline
            Q Offline
            qcoderpro
            wrote on last edited by
            #4

            @sierdzio

            A direct search will return only QLabel and QLineEdit.

            And the QWidget too, yes?

            A recursive search can return QLabel, QLineEdit, QTreeView and QSomething.

            And again, the QWidget too, yes?

            JonBJ 1 Reply Last reply
            0
            • Q qcoderpro

              @sierdzio

              A direct search will return only QLabel and QLineEdit.

              And the QWidget too, yes?

              A recursive search can return QLabel, QLineEdit, QTreeView and QSomething.

              And again, the QWidget too, yes?

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by
              #5

              @qcoderpro
              Yes, in both cases the QWidget would be included.

              1 Reply Last reply
              1
              • sierdzioS Offline
                sierdzioS Offline
                sierdzio
                Moderators
                wrote on last edited by
                #6

                Yep, sure, QWidget too.

                (Z(:^

                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