reserving memory in advance

This commit is contained in:
Uwe Rathmann 2022-03-24 17:33:01 +01:00
parent eeb9e04b60
commit 115141bc21

View File

@ -21,6 +21,8 @@ QObjectList QskObjectTree::childNodes( const QObject* object )
if ( object == nullptr )
{
const auto windows = QGuiApplication::topLevelWindows();
children.reserve( windows.count() );
for ( auto window : windows )
children += window;
}
@ -43,6 +45,7 @@ QObjectList QskObjectTree::childNodes( const QObject* object )
else if ( auto item = qobject_cast< const QQuickItem* >( object ) )
{
const auto childItems = item->childItems();
children.reserve( childItems.count() );
for ( auto child : childItems )
children += child;