Search code examples
qtpaint

Qt draw lines without fill but edge lines


I am trying to draw wide lines like(50 pixel wide) on screen with transparent filling and solid colored edge lines.

Transparent fill with solid edge lines

Any suggestions on how to implement this in Qt?


Solution

    • create a QPainterPath
    • add the desired shapes to it, like QPainterPath::addRoundedRect()
    • use QPainter::strokePath(yourpath, yourpen) to draw just the outline