Details
-
Bug
-
Resolution: Won't Do
-
P2: Important
-
5.4.1
-
None
-
Qt 5.4.1, Kubuntu 14.04 LTS 32 bit
Description
Trying to get a list of children using children() but results into an assert
`
ASSERT: "!isEmpty()" in file ../../../../Qt5.4.1/5.4/gcc/include/QtCore/qlist.h, line 293
`
I've narrowed it down to following example
main.qml
import QtQuick 2.4 Rectangle { width: 100 height: 100 property int xval: 0 Behavior on xval { SmoothedAnimation { //id: a duration: 800 } } /*Rectangle { width: 50 height: 50 Rectangle { width: 10 height: 10 } }*/ }
and loading it as
main.cpp
QQuickView view;
view.setSource(QStringLiteral("qrc:/main.qml"));
view.show();
QQuickItem *item = view.rootObject();
qDebug() << item->children().first()->children().first();
This should actually ouput the SmoothedAnimation object but the children list is actually 0. Now if you specify an id to SmoothedAnimation, the object is found. Is there any compulsion that an id is required ?
I tried the similar scenario with Rectangle (commented code) and it works as expected.