Deleting QQmlContext


    says it is the creators responsibility to delete a context. It then says the easiest way is to make the window its parent (so the window magically knows how to delete it because it is a QObject??). The example looks to me like it is showing you how to have a pointer to the context so you can release the pointer later.

    1. if I create a pointer to the context how do I release the context?
    2. the example says the context is released when window is destroyed but what I need is to keep updating the context (c++ passes data to QML to be displayed in a ListView, when the user selects an item in the ListView the ListView is updated with new data). How do I do that without leaving contexts hanging around?

    void CMenuManager::display(CMenuItem *menuItem)
    get the data into a list.........

    //pass list to QML
    m_guide->getViewer()->rootContext()->setContextProperty("menuModel", QVariant::fromValue(dataList));

Log in to reply

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