My app display a long scientific vertically-scrollable picture (1024 x 99999999... px) as a sequence of QPixmap
1024x128 blocks. This allows me to scroll a picture with minimal CPU-cost by picking needed blocks from a table: block_id = y_coord/128
. Also, QPixmap
is preferred "pixel container" for fast screen output.
But now I have a stream of new data coming to the application and need the new data to be added and displayed at the bottom of the long picture. Minimal portion: 1024x1
(a line). Also, I would like to display each new line as soon as possible (close to real-time). Each new portion of 128 lines will be "packed" to QPixmap
, but until I received enough data I cannot build a whole block.
What approach should I consider for displaying the new data?
This video gives an idea of "adding new lines of data", except in my case the flow goes up: http://www.youtube.com/watch?v=Dy3zyQNK7jM
You can simply, directly, modify the bottom row of QPixmaps and update()
the window (if the bottom row is in range).
You might find using a QImage is more efficient for half-baked rows, depending on how quickly you update/repaint.
On contemporary Qt, when using the raster backend, QPixmap
offers no benefits compared to QImage
. Everything is rendered to a big QImage
backing buffer that then gets blitted to the screen. So just use QImage
.
You can have a QImage
that is 128 pixels high, but you only draw the part of it that was already filled with data. The part without data is either not drawn, or hangs below the visible area of the window, and is thus effectively invisible.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With