Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does Qt draw a border around a rectangle?

Tags:

qt

qpainter

I want to know how Qt does a border when using QPainter's drawRect. The reason for this is I am trying to draw three rectangles next to each other, but I'm having trouble getting them to touch perfectly at all pen sizes.

like image 558
Serodis Avatar asked Feb 12 '12 15:02

Serodis


1 Answers

QPainter's documentation for drawRect says:

A stroked rectangle has a size of [the input rectangle] plus the pen width.

So it goes like this:

enter image description here

like image 118
Oleh Prypin Avatar answered Nov 16 '22 16:11

Oleh Prypin