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. Creating custom model view system for viewing realtime data
QtWS25 Last Chance

Creating custom model view system for viewing realtime data

Scheduled Pinned Locked Moved Unsolved General and Desktop
itemmodelrealtimecustom datacustom model
3 Posts 2 Posters 512 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.
  • J Offline
    J Offline
    jorgeja
    wrote on last edited by
    #1

    Hello. I am creating an application to view data arriving from an embedded device.
    The data arrive in my backend and has an identification "address" which is a string and a list of data with a timestamp for each entry. These data points can be string statuses or measurement data in the form of floats or ints.
    Each data point also contains some information regarding what type of value it is.

    What I want to have is an eventlog that views the incoming data as well as short term historical data.
    I want to see data from different "data points" together in this event log.
    I want to filter this data based on type/contents/address.

    My current implementation is a tableview with three columns (time, address, value) and a standard item model where i just take the data from my underlying backend and create a row for each entry.
    This works OK for a single data point with few entries in its history. But when i try to "build" my eventlog at runtime after i have aggregated a lot of history it gets really slow and in the worst case crashes the application.
    At the moment the data arrives twice a second, but it might include more entries per data point depending on how much it changed between polls.

    I have been looking into creating a custom item model by inheriting QAbstractTableModel, but I find it a bit hard to wrap my head around how to "index" my underlying data.
    I am looking for help for an architecture that might fit my backend data or any other tips.

    Thanks in advance!

    JonBJ 1 Reply Last reply
    0
    • J jorgeja

      Hello. I am creating an application to view data arriving from an embedded device.
      The data arrive in my backend and has an identification "address" which is a string and a list of data with a timestamp for each entry. These data points can be string statuses or measurement data in the form of floats or ints.
      Each data point also contains some information regarding what type of value it is.

      What I want to have is an eventlog that views the incoming data as well as short term historical data.
      I want to see data from different "data points" together in this event log.
      I want to filter this data based on type/contents/address.

      My current implementation is a tableview with three columns (time, address, value) and a standard item model where i just take the data from my underlying backend and create a row for each entry.
      This works OK for a single data point with few entries in its history. But when i try to "build" my eventlog at runtime after i have aggregated a lot of history it gets really slow and in the worst case crashes the application.
      At the moment the data arrives twice a second, but it might include more entries per data point depending on how much it changed between polls.

      I have been looking into creating a custom item model by inheriting QAbstractTableModel, but I find it a bit hard to wrap my head around how to "index" my underlying data.
      I am looking for help for an architecture that might fit my backend data or any other tips.

      Thanks in advance!

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @jorgeja said in Creating custom model view system for viewing realtime data:

      it gets really slow and in the worst case crashes the application.

      I'm thinking: show some code. The updates may or may not get "slow", depending on quantity, but "crash" sounds like there may be something wrong in it. You should also run under debugger and show us the stack trace at "crash" time.

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jorgeja
        wrote on last edited by
        #3

        I should probably mention that i'm writing this in PyQt5 and therefor tried not to mention the code too much. Since the first thing you mention is the code, does that mean that you think architecturally it should work fine with a standardItemModel? I can always code my way around the crash, but i'm more interested in good architecture for this problem. Do you need more information about the data?

        Thanks for the reply :)

        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