I am currently doing a very similar picture with the baud-mapping of a parametric equalizer (a long line with several curves). The way I do it (pseudo-style):
qreal yCoords[GRAPH_WIDTH]; ... QPainter Painter(this); Painter.setRenderHint(QPainter::Antialiasing, true); //Painter.setRenderHint(QPainter::HighQualityAntialiasing, true); //opengl specific for(int xCoord = 0; xCoord < GRAPH_WIDTH; x++) Path.lineTo(QPointF(xCoord, yCoord[xCoord])); ... Painter.drawPath(Path);
The combination of setRenderHint calls and drawing lines with QPointF (i.e. two qreal ) and not QPoint (two int ) makes the line very smooth.
We use this on an SBC running Ubuntu, and we get redraw timeouts (including all the complex math to get points first) ~ 80 ms for a 600x300 pixel graph. Initial tests show that providing opengl rendering reduces this to ~ 8 ms (obviously, an intensive processor task is a picture with antialiasing), so if you can do this, I think this solution will work for you.
sam-w
source share