[Development] QRect::contains and undocumented(?) edge

Thiago Macieira thiago.macieira at intel.com
Thu Apr 21 16:09:37 CEST 2022


On Thursday, 21 April 2022 06:22:57 PDT Tomi Pannila wrote:
> Is there a possibility to add a picture to Qt documentation where you
> have a rectangle grid and shade the
> edge cells with some color to identify them as edges? If I'm the only
> one confused of the term edge, not edge cell, in integer
> rectangle, then this is not needed.

You're not. The problem is that, as Aavit described, the class was designed as 
an intuitive chess board or pixel board, not as a mathematical construct.

A QRect of (0,0) to (1,1) is a 2x2 square. So a square of a single pixel is 
(0,0) to (0,0). But then how do you make an empty QRect, that is, a (0,0) 
+0+0?

It has some unintuitive defects and flaws, but they can't be fixed because 
this class is OLD. We can improve documentation, but that's all. If drawing 
the chess board as a stand-in for the pixel helps understand, then it might be 
a good idea.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel DPG Cloud Engineering





More information about the Development mailing list