Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Sharing QAbstractListModel based models (defined in C++)
Forum Updated to NodeBB v4.3 + New Features

Sharing QAbstractListModel based models (defined in C++)

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 2.4k 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.
  • H Offline
    H Offline
    Hornsj2
    wrote on last edited by
    #1

    I'm dynamically creating QML screens which have models defined in C++ and registered as context properties.

    This works fine until I create two screens which share a model. Both are live, one with opacity set to 0, so as to hide it. In this case I get an access violation after calls such as endResetModel().

    I think the cause is that two screens are tied to the same model and there is resource contention. Does anyone know how to handle this case?

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dialingo
      wrote on last edited by
      #2

      What do you mean with "dynamically creating QML screens"? Do you have one application with multiple top level windows? Is there more than one processes working? Do you have multiple declarative views on a form? Do you run multiple qmlviewer?

      1 Reply Last reply
      0
      • H Offline
        H Offline
        Hornsj2
        wrote on last edited by
        #3

        i created a screen with Qt.createComponent and then saved a pointer to it in a container used as history. I would set the opacity to 0 when I created another screen. This was part of a Back Button feature but I scrapped the pointer approach and use a Loader.

        Since the loader deletes screens as it loads new ones there is no resource contention.

        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