How to draw an outline offset from a QPainterPath?
I am trying to draw a dashed outline a number of pixels around a QPainterPath which is just a series of points (see attached mock-up). I have had no luck with QPainterPathStroker, which seems to draw the stroke right at the edge of the original path and also closes the path around the beginning and ending points drawing a straight line between them.
Any idea how to do this?
That could be quit difficult to do without actually drawing a dotted offset path around it.
You might try drawing three paths on top of each other. First the fattest one with a stipple pattern, then a white one which is slightly smaller to mask the fat one, then the grey one on top of both. You can use the same points and end types for all of them, just change the width of each.
Not sure if it will actually look like what you want though. If you draw the path and stroker correctly it will not close it if you don't want it to. Use pen up and pen down correctly.
Look here, Chris' answer in particular: