QObject::queryList -- searche the children and optionally grandchildren of the object


#include <QtCore/qobject.h>

QObjectList QObject::queryList(const char * inheritsClass = 0 , const char * objName = 0, bool regexpMatch = true, bool recursiveSearch = true);


The QObject::queryList() function shall searche the children and optionally grandchildren of this object.

The function shall return a list of those objects that are named or that match objName and inherit inheritsClass. If inheritsClass is 0 (the default), all classes match. If objName is 0 (the default), all object names match.

If regexpMatch is true (the default), objName is a regular expression that the objects's names must match. The syntax is that of a QRegExp. If regexpMatch is false, objName is a string and object names must match it exactly.

Note that inheritsClass uses single inheritance from QObject, the way inherits() does. According to inherits(), QWidget inherits QObject but not QPaintDevice. This does not quite match reality, but is the best that can be done on the wide variety of compilers Qt supports.

Finally, if recursiveSearch is true (the default), the QObject::queryList() shall search n-th-generation as well as first-generation children.

Warning: Delete the obtained list as soon you have finished using it. The list contains pointers that may become invalid at almost any time without notice (as soon as the user closes a window you may have dangling pointers, for example).

This function is not intended to be used by applications directly, but may appear among appliction dependencies as a result of usage of other functions and macros.

See Also

child(), children(), parent(), inherits(), objectName(), QRegExp()