QGraphicsItem drawing issue
-
Hello,
my problem is that the triangle is not completely filled (just up to the half of pen size) and line joining isn't perfect. The same happens by using my custom classes and with
QGraphicsRectItem
too.
How can be this issue fixed?
My platform is Windows 10, Qt 5.15.
Thanks a lot!
-
@wazzdaman
I don't know exactly what you are asking about/saying is wrong, but is it to do with void QGraphicsItem::paint():In particular, when QPainter renders the outline of a shape using an assigned QPen, half of the outline will be drawn outside, and half inside, the shape you're rendering (e.g., with a pen width of 2 units, you must draw outlines 1 unit inside boundingRect()).
Or is that not relevant to your case?
-
@JonB Thanks for your reply! My goal is to draw a filled triangle like this:
The only way I'm able to achieve this that I draw two shapes: one fills the whole
boundingRect()
and a second one draws the outline inboundingRect()
adjusted by the pen width.I'm not sure that it's a good way to solve this problem. Any tips?