[Interest] QPainter::drawRect incorrectly "rounds" corners

Matthew Woehlke mwoehlke.floss at gmail.com
Wed Oct 21 19:03:49 CEST 2020


I'm implementing a custom widget style for an application, and running 
into a strange problem with QPainter::drawRect. Namely, it is not making 
the corners square.

This may be a problem specific to high-DPI displays and/or using a pen 
width more than one physical pixel. The corner *should* look like this:

   #########################
   #########################
   ##
   ##
   ##

...but it looks like this:

    ########################
   #########################
   ##
   ##
   ##

Oddly, only the *left* corners have this issue; the *right* corners are 
correct.

How can I fix this?

p.s. On a hunch, I tried ensuring that antialiasing was *off*, but that 
had no effect.

-- 
Matthew


More information about the Interest mailing list