PDA

View Full Version : Translating a QPolygon in a Qpainterpath with round corners



dennis81
30th March 2012, 17:16
Hello community,

I am writing a Qt application with a diagram surface.
The diagram contains polygon lines with sharp corners, but I need round ones.
The Line width must be zero, so using a QPen with rounded corners is no option.

Is there a simple algorithm that translates a QPolygon in QPainterpath with rounded corners?

7544


greets,
Dennis

d_stranz
30th March 2012, 18:07
If you're drawing your lines with QPainterPath, why not use the QPainterPath "arc" methods to add the rounded corners as arcs? The size of the QRectF occupied by the arc has a width and height equal to the arc radius, so your lines start or end at the endpoint you would have had for square corners minus the radius.

dennis81
3rd April 2012, 09:49
It works! Thanks!