Solved QObject::findChildren
-
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"? -
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.
-
A widget has a layout and therefore can contain other widgets itself.
-
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.
-
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?
-
@qcoderpro
Yes, in both cases theQWidget
would be included. -
Yep, sure, QWidget too.