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

David M. Cotter dave at kjams.com
Wed Oct 21 19:16:50 CEST 2020


are your pixels specified in floating point?
have you accounted for the half-pixel offset?

> On Oct 21, 2020, at 10:03 AM, Matthew Woehlke <mwoehlke.floss at gmail.com> wrote:
> 
> 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
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> https://lists.qt-project.org/listinfo/interest



More information about the Interest mailing list