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. Non-static ListView model: how does QML Engine react?

Non-static ListView model: how does QML Engine react?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 2 Posters 438 Views
  • 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.
  • devDawgD Offline
    devDawgD Offline
    devDawg
    wrote on last edited by
    #1

    Hello all,

    I am thinking my question is pretty self-explanatory, asking for a not-so-straightforward answer.

    • I am in the process of creating an app that involves a dynamic ListView, where the user is capable of adding, removing, or modifying Components by pressing on-screen buttons.

    • Each of these Components is capable of visualizing data from up to 5 sources. The user is also capable of removing a specified source, or adding another if the limit has not been reached.

    • As you might guess, each Source is constantly handling timeout() signals, appending a new data point to itself whenever this occurs.

    So my ListView is pretty dynamic.

    For this ListView, my model would by a context property C++ class that contains a QVector of lists. Each index of the QVector corresponds to a Component in the ListView, whereas the C++ list at each index of the QVector corresponds to the Sources for each Component. (If you need clarification here, let me know).

    What I am wondering is this: Let's say I use the length of the QVector as my ListView model. When a new list is appended to this QVector, OR let's say a new source is added to an existing list, does QML recognize this and act accordingly? Or rather, is this something I need to handle myself through signals/slots?

    My thinking would be that, because I am using an int as the ListView model, it would be able to detect a list being added or removed, but it would not be able to detect the addition or removal of a source from an existing list in the QVector. Is my thinking correct on this?

    Hopefully I didn't ramble. I tried to provide enough info to provide context, without going overboard.

    Thank you!

    Anything worthwhile is never achieved easily.

    DiracsbracketD 1 Reply Last reply
    0
    • devDawgD devDawg

      Hello all,

      I am thinking my question is pretty self-explanatory, asking for a not-so-straightforward answer.

      • I am in the process of creating an app that involves a dynamic ListView, where the user is capable of adding, removing, or modifying Components by pressing on-screen buttons.

      • Each of these Components is capable of visualizing data from up to 5 sources. The user is also capable of removing a specified source, or adding another if the limit has not been reached.

      • As you might guess, each Source is constantly handling timeout() signals, appending a new data point to itself whenever this occurs.

      So my ListView is pretty dynamic.

      For this ListView, my model would by a context property C++ class that contains a QVector of lists. Each index of the QVector corresponds to a Component in the ListView, whereas the C++ list at each index of the QVector corresponds to the Sources for each Component. (If you need clarification here, let me know).

      What I am wondering is this: Let's say I use the length of the QVector as my ListView model. When a new list is appended to this QVector, OR let's say a new source is added to an existing list, does QML recognize this and act accordingly? Or rather, is this something I need to handle myself through signals/slots?

      My thinking would be that, because I am using an int as the ListView model, it would be able to detect a list being added or removed, but it would not be able to detect the addition or removal of a source from an existing list in the QVector. Is my thinking correct on this?

      Hopefully I didn't ramble. I tried to provide enough info to provide context, without going overboard.

      Thank you!

      DiracsbracketD Offline
      DiracsbracketD Offline
      Diracsbracket
      wrote on last edited by Diracsbracket
      #2

      Hi @devDawg
      Why don't you just try it out as experiment? ^^

      devDawgD 1 Reply Last reply
      1
      • DiracsbracketD Diracsbracket

        Hi @devDawg
        Why don't you just try it out as experiment? ^^

        devDawgD Offline
        devDawgD Offline
        devDawg
        wrote on last edited by
        #3

        @Diracsbracket Great idea! I will re-post here when I have gotten to that point in my development, which should hopefully only take a day or two.

        Anything worthwhile is never achieved easily.

        1 Reply Last reply
        1

        • Login

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