Hi, I'm trying to walk the QML Object hierarchy from C++ to do some automatic binding of UI elements to user generated projects. Since the QML elements aren't created until they first become visible I'm trying to find a central signal or virtual function I can use to catch new QML object being (delay) created from the C++ side without having to create custom Component.onCompleted signals all over the place in the QML.
For example below is a simple QML file, note that Label 2 on the second tab isn't created until the user first opens that tab. Looking at the C++ code below that, is there any way I can catch label2 being created from C++ in a general way? Cheers Matt import QtQuick 2.1 import QtQuick.Controls 1.0 TabView { width: 300 height: 300 Tab { title: "tab1" Label { id: label1 text: "tab1 text" Component.onCompleted: { console.log("tab 1 created") } } } Tab { title: "tab2" Label { id: label2 text: "tab2 text" Component.onCompleted: { console.log("tab 2 created") } } } } On the C++ side I have something like: QQuickView* quickView = new QQuickView(QUrl::fromLocalFile("simple.qml")); QQuickItem* root = quickView->rootObject(); // With root I can now walk the tree of QObjects and look at properties but this won't include label2 // How can I add something here so I'm informed when an element like label2 is actually created?
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest