Following is a code written to load a QML document to c++.
QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
// Create root object for the UI
AbstractPane *root = qml->createRootObject<AbstractPane>();
app->setScene(root);
}
How do I access the objects of the QMLdocument, such as a button etc; from C++. I need to access them to find the memory address of a specific object in the QML document.
ImageView* iv= root->findChild<bb::cascades::ImageView*>("myImageView");
and in QML
ImageView
{
// ...
objectName: "myImageView"
}
Edit: Don't forget to clean and rebuild the project.