[Qt-qml] Accessing QML objects from C++
John Vilburn
john at ohanasoftware.com
Thu May 27 08:38:42 CEST 2010
If I create a QML object from C++ using the following code:
QDeclarativeEngine *engine = new QDeclarativeEngine( this );
QDeclarativeComponent mainComponent(engine, QUrl("Main.qml"));
QDeclarativeItem *mainQml = 0;
if ( mainComponent.isReady() )
{
mainQml = qobject_cast<QDeclarativeItem *>(mainComponent.create(engine->rootContext()));
}
and Main.qml creates a child QML object from the component in Toolbar.qml, is it possible for the C++ code to get a pointer to a QDeclarativeItem for the toolbar object and access values from that object? Or is there some other way for the C++ code to access values from the toolbar object?
Thanks,
John
More information about the Qt-qml
mailing list