How to Qt draw a border around a rectangle?

I want to know how Qt creates a border when using a QPainter drawRect. The reason for this is because I am trying to draw three rectangles next to each other, but I had problems getting them to fully touch all pen sizes.

+7
source share
1 answer

QPainter documentation for drawRect says:

The stroked rectangle is the size of the [input rectangle] plus the width of the pen.

So it looks like this:

enter image description here

+19
source

All Articles