Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Deleting QQmlContext

Deleting QQmlContext

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 802 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dolphin
    wrote on last edited by
    #1

    http://qt-project.org/forums/viewforum/10/

    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));
    }
    @

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved