qt5base-lts/examples/widgets/painting/shared
Marc Mutz 2b50c8bec0 QObject: optimize the common case of findChildren(QString())
Outside tests, all in-tree callers of QObject::findChildren() pass no
name to match, and in my experience that is also true for the vast
majority of out-of-tree users.

Avoid the temporary QString creation in the caller and the repeated
QString::isNull() checks in the implementation by overloading
findChildren() without a name argument and checking for name.isNull()
only once, forking off into separate helper functions.

Adjust in-tree callers that used an explicit `QString()` argument in
order to pass options, which goes to show that `name` should never
have been the first argument of findChilden() in the first place, even
though I appreciate the symmetry with findChild() (the use-cases of
which, however, are radically different).

Change a `findChildren().size() == 0` call found while scanning for
findChildren() calls to `!findChild()` as a drive-by.

Modernize loops in the various qt_qFindChild{,ren}_helper() overloads
to match how the new code looks.

[ChangeLog][QtCore][QObject] Added findChildren() overload taking no
name (thus optimizing this common case).

Change-Id: Ifc56e5438023d079b40c67f11ae274a3e128ad5e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-07-13 16:57:31 +02:00
..
images Moving .qdoc files under examples/widgets/doc 2012-08-20 12:20:55 +02:00
arthurstyle.cpp QObject: optimize the common case of findChildren(QString()) 2021-07-13 16:57:31 +02:00
arthurstyle.h Cleanup QtWidgets examples 2019-10-11 06:32:30 +02:00
arthurwidgets.cpp Move QStringRef and remains to Qt5Compat 2020-08-20 00:58:13 +02:00
arthurwidgets.h Move arthurwidget based examples to new QOpenGL classes 2018-10-17 09:16:01 +00:00
CMakeLists.txt Fix build of standalone painting examples 2021-05-17 17:14:10 +02:00
fbopaintdevice.cpp Cleanup QtWidgets examples 2019-10-11 06:32:30 +02:00
fbopaintdevice.h Cleanup QtWidgets examples 2019-10-11 06:32:30 +02:00
hoverpoints.cpp Port examples away from deprecated QTouchEvent APIs 2021-04-17 09:18:11 +02:00
hoverpoints.h Use QList instead of QVector in examples 2020-06-23 14:01:11 +02:00
shared.pri Move QOpenGLWindow from QtGui to QtOpenGL 2020-01-15 15:38:59 +01:00
shared.qrc Moving .qdoc files under examples/widgets/doc 2012-08-20 12:20:55 +02:00
use_lib.cmake Fix build of standalone painting examples 2021-05-17 17:14:10 +02:00