Äîęķėåíō âį˙ō čį ęũøā īîčņęîâîé ėāøčíû. Āäđåņ
îđčãčíāëüíîãî äîęķėåíōā
: http://rtm-cs.sinp.msu.ru/manual/qt/qrect.html
Äāōā čįėåíåíč˙: Sun Jul 12 02:58:59 1998 Äāōā číäåęņčđîâāíč˙: Mon Oct 1 19:52:46 2012 Ęîäčđîâęā: |
The QRect class defines a rectangle in the plane. More...
#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 in qwindowdefs.h as short).
The minimum value of QCOORD is QCOORD_MIN (-32768) and the maximum
value is QCOORD_MAX (32767).
Note 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 rectangle will both be 1.
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 has origin (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.
Examples: tictac/tictac.cpp forever/forever.cpp desktop/desktop.cpp tooltip/tooltip.cpp movies/main.cpp xform/xform.cpp
Constructs an empty rectangle.
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 top, left corner and width and height.
Example (creates three identical rectangles):
QRect r1( QPoint(100,200), QPoint(110,215) ); QRect r2( QPoint(100,200), QSize(11,16) ); QRect r3( 100, 200, 11, 16 );
Returns the bottom coordinate of the rectangle.
See also: top(), setBottom(), bottomLeft() and bottomRight().
Examples: desktop/desktop.cpp
Returns the bottom left position of the rectangle.
See also: moveBottomLeft(), bottomRight(), topLeft(), topRight(), bottom() and left().
Examples: tictac/tictac.cpp
Returns the bottom right position of the rectangle.
See also: moveBottomRight(), bottomLeft(), topLeft(), topRight(), bottom() and right().
Examples: tictac/tictac.cpp
Returns the center point of the rectangle.
See also: moveCenter(), topLeft(), topRight(), bottomLeft() and bottomRight().
Examples: tooltip/tooltip.cpp
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 this rectangle.
If proper is TRUE, this function returns TRUE only if r is entirely inside (not on the edge).
See also: unite(), intersect() and intersects().
Extracts the rectangle parameters as the top left point and the bottom right point.
See also: setCoords() and rect().
Returns the height of the rectangle. The height includes both the top and bottom edges, ie. height = bottom - top + 1.
See also: width(), size() and setHeight().
Examples: tictac/tictac.cpp desktop/desktop.cpp movies/main.cpp xform/xform.cpp
Returns the intersection rectangle of this rectangle and r.
Returns an empty rectangle if there is no intersection.
See also: isEmpty(), intersects(), unite() and contains().
Returns TRUE if this rectangle intersects with r (there is at least one pixel which is within both rectangles).
See also: intersect() and contains().
Returns TRUE if the rectangle is empty, otherwise FALSE.
An empty rectangle has a left() > right() or top() > bottom().
An empty rectangle is not valid.
isEmpty() == !isValid()
See also: isNull() and isValid().
Returns TRUE if the rectangle is a null rectangle, otherwise FALSE.
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 the rectangle has width 1 and height 1.
A null rectangle is also empty.
A null rectangle is not valid.
See also: isEmpty() and isValid().
Returns TRUE if the rectangle is valid, or FALSE if it is invalid (empty).
A valid rectangle has a left() <= right() and top() <= bottom().
isValid() == !isEmpty()
See also: isNull(), isEmpty() and normalize().
Examples: tooltip/tooltip.cpp
Returns the left coordinate of the rectangle. Identical to x().
See also: x(), top(), right(), setLeft(), topLeft() and bottomLeft().
Examples: tictac/tictac.cpp desktop/desktop.cpp xform/xform.cpp
Sets the bottom left position of the rectangle to p, leaving the size unchanged.
See also: bottomLeft(), moveBottomRight(), moveTopLeft(), moveTopRight(), setBottom() and setLeft().
Sets the bottom right position of the rectangle to p, leaving the size unchanged.
See also: bottomRight(), moveBottomLeft(), moveTopLeft(), moveTopRight(), setBottom() and setRight().
Moves the rectangle dx along the X axis and dy along the Y axis, relative to the current position. (Positive values moves the rectangle rightwards and/or downwards.).
Examples: xform/xform.cpp
Sets the center point of the rectangle to p, leaving the size unchanged.
See also: center(), moveTopLeft(), moveTopRight(), moveBottomLeft() and moveBottomRight().
Examples: tictac/tictac.cpp
Sets the top left position of the rectangle to p, leaving the size unchanged.
See also: topLeft(), moveTopRight(), moveBottomLeft(), moveBottomRight(), setTop() and setLeft().
Examples: xform/xform.cpp
Sets the top right position of the rectangle to p, leaving the size unchanged.
See also: topRight(), moveTopLeft(), moveBottomLeft(), moveBottomRight(), setTop() and setRight().
Returns a normalized rectangle, i.e. one that has a non-negative width and height.
It swaps left and right if left() > right(), and swaps top and bottom if top() > bottom().
See also: isValid().
Extracts the rectangle parameters as the position and the size.
See also: setRect() and coords().
Returns the right coordinate of the rectangle.
See also: left(), setRight(), topRight() and bottomRight().
Examples: desktop/desktop.cpp
Sets the bottom edge of the rectangle. May change the height, but will never change the top edge of the rectangle.
See also: bottom(), setTop() and setHeight().
Sets the coordinates of the rectangle's top left corner to (xp1,yp1), and the coordinates of its bottom right corner to (xp2,yp2).
See also: coords() and setRect().
Sets the height of the rectangle to h. The top edge is not moved, but the bottom edge may be moved.
See also: height(), setTop(), setBottom() and setSize().
Examples: desktop/desktop.cpp
Sets the left edge of the rectangle. May change the width, but will never change the right edge of the rectangle.
Identical to setX().
See also: left(), setTop() and setWidth().
Sets the coordinates of the rectangle's top left corner to (x,y), and its size to (w,h).
See also: rect() and setCoords().
Sets the right edge of the rectangle. May change the width, but will never change the left edge of the rectangle.
See also: right(), setLeft() and setWidth().
Sets the size of the rectangle to s. The top left corner is not moved.
See also: size(), setWidth() and setHeight().
Examples: xform/xform.cpp
Sets the top edge of the rectangle. May change the height, but will never change the bottom edge of the rectangle.
Identical to setY().
See also: top(), setBottom() and setHeight().
Sets the width of the rectangle to w. The right edge is changed, but not the left edge.
See also: width(), setLeft(), setRight() and setSize().
Examples: desktop/desktop.cpp
Sets the x position of the rectangle (its left end). May change the width, but will never change the right edge of the rectangle.
Identical to setLeft().
Sets the y position of the rectangle (its top). May change the height, but will never change the bottom edge of the rectangle.
Identical to setTop().
Returns the size of the rectangle.
See also: width() and height().
Examples: desktop/desktop.cpp movies/main.cpp
Returns the top coordinate of the rectangle. Identical to y().
See also: y(), left(), bottom(), setTop(), topLeft() and topRight().
Examples: tictac/tictac.cpp desktop/desktop.cpp xform/xform.cpp
Returns the top left position of the rectangle.
See also: moveTopLeft(), topRight(), bottomLeft(), bottomRight(), left() and top().
Examples: tictac/tictac.cpp
Returns the top right position of the rectangle.
See also: moveTopRight(), topLeft(), bottomLeft(), bottomRight(), top() and right().
Examples: tictac/tictac.cpp
Returns the union rectangle of this rectangle and r. The union rectangle of a nonempty rectangle and an empty or invalid rectangle is defined to be the nonempty rectangle.
See also: intersect(), intersects() and contains().
Examples: xform/xform.cpp
Returns the width of the rectangle. The width includes both the left and right edges, ie. width = right - left + 1.
See also: height(), size() and setHeight().
Examples: tictac/tictac.cpp desktop/desktop.cpp movies/main.cpp xform/xform.cpp
Returns the left coordinate of the rectangle. Identical to left().
See also: left(), y() and setX().
Examples: desktop/desktop.cpp movies/main.cpp xform/xform.cpp
Returns the top coordinate of the rectangle. Identical to top().
See also: top(), x() and setY().
Examples: desktop/desktop.cpp movies/main.cpp xform/xform.cpp
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 and returns a reference to the stream.
Serialization format: [left (INT16), top (INT16), right (INT16), bottom (INT16)].
Reads a QRect from the stream and returns a reference to the stream.
Search the documentation, FAQ, qt-interest archive and more (uses
www.troll.no):
This file is part of the Qt toolkit, copyright © 1995-98 Troll Tech, all rights reserved.
It was generated from the following files:
Copyright Š 1998 Troll Tech | Trademarks | Qt version 1.40
|