Quantcast
Channel: Qt DevNet forums: Qt Quick 1283365070**
Viewing all articles
Browse latest Browse all 4972

QML context of dynamically generated items

$
0
0
Since you are passing the parent as Tab_view, it should be children of the tabview only. It will be in the current context itself. Here is the sample which I tried and it works perfectly. I suspect that either object is not created or you are not iterating the correct object. Try with following code snippet. It should work        QQuickView view;     view.setSource(QUrl(QStringLiteral("qrc:///main.qml")));     view.show();       QQuickItem *item = view->rootObject();     QQuickItem *obj = qobject_cast<QQuickItem *>(item->findChild<QQuickItem*>("myObj"));     if (obj)         qDebug() << "My name is ="<<obj->objectName();

Viewing all articles
Browse latest Browse all 4972

Trending Articles