Component onCompleted confusion?
-
You can do this:
Component.onCompleted: {blah blah}
But you cannot do this:
Component { id: blah onCompleted: { blah blah } Item { } }
The second version will come back with:
"qrc:/CellList.qml:73 Component elements may not contain properties other than id\n"
Instead I need to put a Component.onCompleted inside the Item inside the Component.
-
onCompleted
andonDestruction
are attached signals, not owned by Component. AlsoComponent
is not an QML element and do not acts like other one. -
You can do this:
Component.onCompleted: {blah blah}
But you cannot do this:
Component { id: blah onCompleted: { blah blah } Item { } }
The second version will come back with:
"qrc:/CellList.qml:73 Component elements may not contain properties other than id\n"
Instead I need to put a Component.onCompleted inside the Item inside the Component.
@fcarney hi
there might be little confusion because when you create a reusable QML file it is called a qml component, and there is also a QML type called Componentthis can clyrify everything
https://doc.qt.io/qt-5/qml-qtqml-component.html#details -
onCompleted is for the object Creation signal. As suggested by @LeLev you are creating the re-usable component. Move your onCompleted inside the Item object.