[Interest] QPainter drawLine zValue?

Christoph Feck cfeck at kde.org
Wed Sep 25 21:03:30 CEST 2019


On 09/25/19 19:13, Israel Brewster wrote:
> Is there a way to set the Z value of the line drawn by the QPainter::DrawLine() function? I have a library that uses the drawLine function to create a grid, and I would like to keep the grid on the top as I draw other things, if possible. Thanks.

QPainter has no concept of a Z value. I suggest to look at 
QGraphicsView; it allows placing items with a Z coordinate, but also has 
support for permanent background and foreground graphics, either via 
brush or callback functions.

To minimize porting, you could wrap all your "other" painter calls into 
a single QGraphicsItem; but you could also split your scene into 
multiple smaller items.



More information about the Interest mailing list