Reputation: 14613
If you check Qt's docs on the point-in-rectangle test they say:
bool QRectF::contains(const QPointF & point) const
Returns true if the given point is inside or on the edge of the rectangle; otherwise returns false.
This inevitably means a point may belong to up to 4 rectangles, bordering each other, at once. Does there exist an argument in favor of this arrangement, or would it be better for the rectangle to contain only points on some edges (say, top-left)?
Upvotes: 0
Views: 1219
Reputation: 10455
Documentation says "edges" and not "corners". Usually edge means a line, while corner or vertex means a point.
If you want to exclude edges, QRect
version of contains()
can do that.
You can also write your own contains()
and check whether the point is in the top left corner using QRectF::topLeft()
.
Rectangles may also intersect, so a point can be contained in any number of rectangles at the same time.
Upvotes: 1