[Interest] Performance of QGraphics[View Scene] changes with zoom

Lisandro Damián Nicanor Pérez Meyer perezmeyer at gmail.com
Thu May 19 03:15:51 CEST 2016


On 18 May 2016 at 15:57, Lisandro Damián Nicanor Pérez
<perezmeyer at gmail.com> wrote:
> Before I try to code a stripped-down version of my issue I would like to
> describe it in case I'm missing something obvious.
>
> I have an app with a QGraphicsScene that holds a vehicle which is constantly
> moving at a fixed rate (~10 times per second). Every time it moves it draws
> some polygons behind (the path it went trough). Up to that point, everything
> is ok.
>
> Now if I add a lot of straight lines (QGraphicsLineItem instances) performance
> (number of movements seen on screen per second) varies according the zoom. If
> I zoom in I get to a point in which everything is too slow. If I zoom out
> things go back to normal. Note that once the lines are generated they are not
> changed in any way.
>
> I understand that performance might decrease if those lines are near 45º due
> to bounding boxes, but I fail to understand why it varies with zoom.

I minimized my code to simple lines and drawing the bounding box of
the vehicle, and found
out that the problems starts if I use anything different than
Qt::SolidLine for drawing the lines.

As soon as I zoom out enough (the transformation matrix becoming
0.1*Identity) the problem
"goes away", so I suspect a rasterization issue.


-- 
Lisandro Damián Nicanor Pérez Meyer
http://perezmeyer.com.ar/
http://perezmeyer.blogspot.com/



More information about the Interest mailing list