Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Creating custom model view system for viewing realtime data
jorgeja last edited by
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!
JonB last edited by
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.
jorgeja last edited by
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 :)