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

Tomi Pannila tpannila at gmail.com
Thu Apr 21 15:22:57 CEST 2022

Hi Eirik,

I start to understand your point of view. You view edge from programming 
point of view?
Like if you have a chess board, an edge cell is one where one cannot 
take one cell step to all directions?
If I would have to point an edge of a chess board, I would point to the 
physical edge.
If you draw a chess board to a grid and ask for an edge, I would point 
the line intervals at the edges.

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.

Best Regards,
Tomi Pannila

On 21.4.2022 11.39, Eirik Aavitsland wrote:
> On 4/20/22 17:50, Tomi Pannila wrote:
>> Hi Lars and Eirik,
>> thank you for the explanations. I guess Eirik kind of guessed right 
>> that I view QRect from $\mathbb{R}^2$ point of view.
>> I'm a mathematician and this is the most natural point of view for 
>> me. For me, rectangles have edges=boundary which are measure zero.
> But QRect is not a mathematical (cartesian) rectangle, instead it 
> describes a chess board. If one asks anybody which squares are on the 
> edge of the board, they will correctly point out row 1 and 8, and 
> column A and H. That is exactly the meaning of "edge" in the doc of 
> QRect::contains() - it is the everyday, intuitive and obvious meaning. 
> So I don't see the problem with the current api, except for the 
> anonymosity of the bool parameter, as Lars pointed out. Also, there is 
> an overload of QRect::contains() without the bool parameter, so no 
> edge to worry about at all, so I don't really understand what the 
> problem is.
> (And if one wants to do operate on rects with borders, one can simply 
> use QMargins together with QRect, e.g. QRect::marginsAdded()).
> Cheers,
> - Eirik Aa.

More information about the Development mailing list