How QObject got notified when children add in
-
Consider this qml file:
@CustomObject// inherts from QtObject
{
id: parent
QtObject
{
id: child_1
}
}@When instancing this qml script, how can "parent" got notified when "child_1" become its child? I want to make some connections in C++ code, to do a little extra things.
CustomObject is well defined in C++ and exported to QML environment. -
Events are used for that.
Reimplement bool QObject::childEvent(QChildEvent* e); and do your magic :)