Is it possible to set the root object of an QQuickView?

  • In C++ I created a QQuickItem and want to set this as the root object of a QQuickView. The following is a simplified part of my code:
    void MyClass::showItem(QQuickItem *item)
    //create the viewer
    QQuickView *viewer = new QQuickView(m_engine, m_parent);

    // here I want to set the item as root object
    //show the viewer


    The item and the view were created using the same engine (m_engine). Unfortunately there is no method like "setRootItem(QQuickItem*)". Is there still the possibility to set the root item of a QQuickView?


Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.