We had some QDeclarativeView, we loaded and opened qml file. How to get pointer to some of its elements (say QWebView from qml's WebView with some Id, placed inside some rectangle)?
I think you need to read this
It explains how to get a reference to a qml object in the section named "Loading QML components from C++"
QML components are essentially object trees with children that have siblings and their own children. Child objects of QML components can be located using the QObject::objectName property with QObject::findChild(). For example, if the root item in MyItem.qml had a child Rectangle item:
So if you need to get a reference you have to write something like
QObject *object = yourview.rootObject();
QObject *your_obj = object->findChild<QObject*>("yourobjName");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With