diff options
author | Rym Bouabid <rym.bouabid@qt.io> | 2023-10-09 17:11:38 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2023-11-22 14:42:17 +0000 |
commit | bf946e8e3ba05af7fd8cb3737082dcfddaabf0e1 (patch) | |
tree | bd737c650873a50f037466d1daeeb0316f38e012 /src/corelib/kernel/qobject.cpp | |
parent | 1126a590f92b2642d52d51787c4bee8866f1b685 (diff) |
QObject: allow calling findChild() without a name
Add an overload of findChild() without a name argument to be able to
call the function with options value only.
[ChangeLog][QtCore][QObject] Added findChild() overload taking no name.
Task-number: QTBUG-103986
Change-Id: Id06b6041408fcf4cc1eeba975afce03f3a28f858
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Diffstat (limited to 'src/corelib/kernel/qobject.cpp')
-rw-r--r-- | src/corelib/kernel/qobject.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 1319402839..fd58f33bf4 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -2023,6 +2023,24 @@ void QObject::killTimer(int id) */ /*! + \fn template<typename T> T *QObject::findChild(Qt::FindChildOptions options) const + \overload + \since 6.7 + + Returns the child of this object that can be cast into type T, or + \nullptr if there is no such object. + The search is performed recursively, unless \a options specifies the + option FindDirectChildrenOnly. + + If there is more than one child matching the search, the most-direct ancestor + is returned. If there are several most-direct ancestors, the first child in + children() will be returned. In that case, it's better to use findChildren() + to get the complete list of all children. + + \sa findChildren() +*/ + +/*! \fn template<typename T> QList<T> QObject::findChildren(QAnyStringView name, Qt::FindChildOptions options) const Returns all children of this object with the given \a name that can be |