The QRect class defined a rectangle in the plane. (details) (complete member list)
#include <qrect.h>
A rectangle is internally represented as an upper left corner and a bottom right corner, but it is normally expressed as an upper left corner and a size.
The coordinate type is QCOORD (defined as short
). The minimum
value of QCOORD is -32768 and the maximum value is 32767.
Notice that the size (width and height) of a rectange might be different from what you are used to. If the top left corner and the bottom right corner are the same, then the height and the width of the rectange will both be one.
Generally, width = right - left + 1 and height = bottom - top + 1. We designed it this way to make it correspond to rectangular spaces used by drawing functions, where the width and height denote a number of pixels. For example, drawing a rectangle with width and height 1 draws a single pixel.
The default coordinate system is assumed to have its origo (0,0) in the top left corner, the positive direction of the y axis is downwards and the positive x axis is from the left to the right.
Constructs a rectangle with undefined position and size.
Constructs a rectangle with topleft as the top left corner and bottomright as the bottom right corner.
Constructs a rectangle with topleft as the top left corner and size as the rectangle size.
Constructs a rectangle with the a top left corner and a width and a height.
Returns the bottom coordinate of the rectangle.
Returns the bottom left position of the rectangle.
Returns the bottom right position of the rectangle.
Returns the center point of the rectangle.
Returns TRUE if the point p is inside or on the edge of the rectangle.
If proper is TRUE, this function returns TRUE only if p is inside (not on the edge).
Returns TRUE if the rectangle r is inside or if it touches an edge of this rectangle.
If proper is TRUE, this function returns TRUE only if r is inside (not on the edge).
Extracts the rectangle parameters as the top left point and the bottom right point.
Repairs an invalid rectangle.
It swaps left and right if left() > right(), and swaps top and bottom if top() > bottom().
See also: isValid().
Returns the height of the rectangle.
height = bottom - top + 1.
Returns the intersection rectangle of this rectangle and r.
The returned rectangle will be empty if there is no intersection.
See also: isEmpty().
Returns TRUE if this rectangle intersects with r.
Returns TRUE if the rectangle is empty, or FALSE if it is not empty.
An empty rectangle has a left() > right() or top() > bottom().
An empty rectangle is not valid.
See also: isValid().
Returns TRUE if the rectangle is a null rectangle.
A null rectangle has both the width and the height set to 0, that is right() == left() - 1 and bottom() == top() - 1.
Remember that if right() == left() and bottom() == top(), then we have a rectangle with width 1 and height 1.
A null rectangle is also empty.
A null rectangle is not valid.
See also: isEmpty() and isValid().
Returns if the rectangle is valid, or FALSE if it is invalid.
A valid rectangle has a left() <= right() and top() <= bottom().
Returns the left coordinate of the rectangle.
Moves the rectangle dx along the X axis and dy along the Y axis.
Extracts the rectangle parameters as the position and the size.
Returns the right coordinate of the rectangle.
Sets the bottom position of the rectangle, possibly changing the height.
See also: bottom().
Sets the bottom left position of the rectangle to p, leaving the size unchanged.
Sets the bottom right position of the rectangle to p, leaving the size unchanged.
Sets the center point of the rectangle to p, leaving the size unchanged.
Sets the rectangle to a top left position and bottom right position.
Sets the left position of the rectangle, possibly changing the width.
Sets the rectangle to a top left position and a size.
Sets the right position of the rectangle, possibly changing the width.
See also: right().
Sets the size of the rectangle to s.
Sets the top position of the rectangle, possibly changing the height.
Sets the top left position of the rectangle to p, leaving the size unchanged.
Sets the top right position of the rectangle to p, leaving the size unchanged.
Sets the x (left) position of the rectangle, possibly changing the width.
Synonymous to setLeft().
Sets the y (top) position of the rectangle, possibly changing the height.
Synonymous to setTop().
Returns the size of the rectangle.
Returns the top coordinate of the rectangle.
Returns the top left position of the rectangle.
Returns the top right position of the rectangle.
Returns the union rectangle of this rectangle and r.
Returns the width of the rectangle.
width = right - left + 1.
Returns the left coordinate of the rectangle.
Synonymous to left().
Returns the top coordinate of the rectangle.
Synonymous to top().
Returns TRUE if r1 and r2 are equal, or FALSE if they are different.
Returns TRUE if r1 and r2 are different, or FALSE if they are equal.
Writes a QRect to the stream.
The output format is four INT16 (order: left, top, right, bottom).
Reads a QRect from the stream.
This file is part of the Qt toolkit, copyright 1995 Troll Tech, all rights reserved.
It was generated from the following files: