You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
663 lines
24 KiB
663 lines
24 KiB
13 years ago
|
'\" t
|
||
|
.TH QRect 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*-
|
||
|
.\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
|
||
|
.\" license file included in the distribution for a complete license
|
||
|
.\" statement.
|
||
|
.\"
|
||
|
.ad l
|
||
|
.nh
|
||
|
.SH NAME
|
||
|
QRect \- Defines a rectangle in the plane
|
||
|
.SH SYNOPSIS
|
||
|
\fC#include <qrect.h>\fR
|
||
|
.PP
|
||
|
.SS "Public Members"
|
||
|
.in +1c
|
||
|
.ti -1c
|
||
|
.BI "\fBQRect\fR ()"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "\fBQRect\fR ( const QPoint & topLeft, const QPoint & bottomRight )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "\fBQRect\fR ( const QPoint & topLeft, const QSize & size )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "\fBQRect\fR ( int left, int top, int width, int height )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "bool \fBisNull\fR () const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "bool \fBisEmpty\fR () const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "bool \fBisValid\fR () const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "QRect \fBnormalize\fR () const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "int \fBleft\fR () const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "int \fBtop\fR () const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "int \fBright\fR () const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "int \fBbottom\fR () const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "QCOORD & \fBrLeft\fR ()"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "QCOORD & \fBrTop\fR ()"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "QCOORD & \fBrRight\fR ()"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "QCOORD & \fBrBottom\fR ()"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "int \fBx\fR () const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "int \fBy\fR () const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBsetLeft\fR ( int pos )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBsetTop\fR ( int pos )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBsetRight\fR ( int pos )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBsetBottom\fR ( int pos )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBsetX\fR ( int x )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBsetY\fR ( int y )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBsetTopLeft\fR ( const QPoint & p )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBsetBottomRight\fR ( const QPoint & p )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBsetTopRight\fR ( const QPoint & p )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBsetBottomLeft\fR ( const QPoint & p )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "QPoint \fBtopLeft\fR () const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "QPoint \fBbottomRight\fR () const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "QPoint \fBtopRight\fR () const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "QPoint \fBbottomLeft\fR () const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "QPoint \fBcenter\fR () const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBrect\fR ( int * x, int * y, int * w, int * h ) const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBcoords\fR ( int * xp1, int * yp1, int * xp2, int * yp2 ) const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBmoveLeft\fR ( int pos )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBmoveTop\fR ( int pos )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBmoveRight\fR ( int pos )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBmoveBottom\fR ( int pos )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBmoveTopLeft\fR ( const QPoint & p )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBmoveBottomRight\fR ( const QPoint & p )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBmoveTopRight\fR ( const QPoint & p )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBmoveBottomLeft\fR ( const QPoint & p )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBmoveCenter\fR ( const QPoint & p )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBmoveBy\fR ( int dx, int dy )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBsetRect\fR ( int x, int y, int w, int h )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBsetCoords\fR ( int xp1, int yp1, int xp2, int yp2 )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBaddCoords\fR ( int xp1, int yp1, int xp2, int yp2 )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "QSize \fBsize\fR () const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "int \fBwidth\fR () const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "int \fBheight\fR () const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBsetWidth\fR ( int w )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBsetHeight\fR ( int h )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBsetSize\fR ( const QSize & s )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "QRect \fBoperator|\fR ( const QRect & r ) const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "QRect \fBoperator&\fR ( const QRect & r ) const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "QRect & \fBoperator|=\fR ( const QRect & r )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "QRect & \fBoperator&=\fR ( const QRect & r )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "bool \fBcontains\fR ( const QPoint & p, bool proper = FALSE ) const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "bool \fBcontains\fR ( int x, int y ) const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "bool \fBcontains\fR ( int x, int y, bool proper ) const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "bool \fBcontains\fR ( const QRect & r, bool proper = FALSE ) const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "QRect \fBunite\fR ( const QRect & r ) const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "QRect \fBintersect\fR ( const QRect & r ) const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "bool \fBintersects\fR ( const QRect & r ) const"
|
||
|
.br
|
||
|
.in -1c
|
||
|
.SH RELATED FUNCTION DOCUMENTATION
|
||
|
.in +1c
|
||
|
.ti -1c
|
||
|
.BI "bool \fBoperator==\fR ( const QRect & r1, const QRect & r2 )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "bool \fBoperator!=\fR ( const QRect & r1, const QRect & r2 )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "QDataStream & \fBoperator<<\fR ( QDataStream & s, const QRect & r )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "QDataStream & \fBoperator>>\fR ( QDataStream & s, QRect & r )"
|
||
|
.br
|
||
|
.in -1c
|
||
|
.SH DESCRIPTION
|
||
|
The QRect class defines a rectangle in the plane.
|
||
|
.PP
|
||
|
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.
|
||
|
.PP
|
||
|
The coordinate type is QCOORD (defined in qwindowdefs.h as \fCint\fR). The minimum value of QCOORD is QCOORD_MIN (-2147483648) and the maximum value is QCOORD_MAX (2147483647).
|
||
|
.PP
|
||
|
Note that the size (width and height) of a rectangle might be different from what you are used to. If the top-left corner and the bottom-right corner are the same, the height and the width of the rectangle will both be 1.
|
||
|
.PP
|
||
|
Generally, \fIwidth = right - left + 1\fR and \fIheight = bottom - top + 1\fR. We designed it this way to make it correspond to rectangular spaces used by drawing functions in which the width and height denote a number of pixels. For example, drawing a rectangle with width and height 1 draws a single pixel.
|
||
|
.PP
|
||
|
The default coordinate system has origin (0, 0) in the top-left corner. The positive direction of the y axis is down, and the positive x axis is from left to right.
|
||
|
.PP
|
||
|
A QRect can be constructed with a set of left, top, width and height integers, from two QPoints or from a QPoint and a QSize. After creation the dimensions can be changed, e.g. with setLeft(), setRight(), setTop() and setBottom(), or by setting sizes, e.g. setWidth(), setHeight() and setSize(). The dimensions can also be changed with the move functions, e.g. moveBy(), moveCenter(), moveBottomRight(), etc. You can also add coordinates to a rectangle with addCoords().
|
||
|
.PP
|
||
|
You can test to see if a QRect contains a specific point with contains(). You can also test to see if two QRects intersect with intersects() (see also intersect()). To get the bounding rectangle of two QRects use unite().
|
||
|
.PP
|
||
|
See also QPoint, QSize, Graphics Classes, and Image Processing Classes.
|
||
|
.SH MEMBER FUNCTION DOCUMENTATION
|
||
|
.SH "QRect::QRect ()"
|
||
|
Constructs an invalid rectangle.
|
||
|
.SH "QRect::QRect ( const QPoint & topLeft, const QPoint & bottomRight )"
|
||
|
Constructs a rectangle with \fItopLeft\fR as the top-left corner and \fIbottomRight\fR as the bottom-right corner.
|
||
|
.SH "QRect::QRect ( const QPoint & topLeft, const QSize & size )"
|
||
|
Constructs a rectangle with \fItopLeft\fR as the top-left corner and \fIsize\fR as the rectangle size.
|
||
|
.SH "QRect::QRect ( int left, int top, int width, int height )"
|
||
|
Constructs a rectangle with the \fItop\fR, \fIleft\fR corner and \fIwidth\fR and \fIheight\fR.
|
||
|
.PP
|
||
|
Example (creates three identical rectangles):
|
||
|
.PP
|
||
|
.nf
|
||
|
.br
|
||
|
QRect r1( QPoint(100,200), QPoint(110,215) );
|
||
|
.br
|
||
|
QRect r2( QPoint(100,200), QSize(11,16) );
|
||
|
.br
|
||
|
QRect r3( 100, 200, 11, 16 );
|
||
|
.br
|
||
|
.fi
|
||
|
.SH "void QRect::addCoords ( int xp1, int yp1, int xp2, int yp2 )"
|
||
|
Adds \fIxp1\fR, \fIyp1\fR, \fIxp2\fR and \fIyp2\fR respectively to the existing coordinates of the rectangle.
|
||
|
.PP
|
||
|
Examples:
|
||
|
.)l multiple/ax1.h and multiple/ax2.h.
|
||
|
.SH "int QRect::bottom () const"
|
||
|
Returns the bottom coordinate of the rectangle.
|
||
|
.PP
|
||
|
See also setBottom(), top(), bottomLeft(), and bottomRight().
|
||
|
.PP
|
||
|
Examples:
|
||
|
.)l action/application.cpp, application/application.cpp, desktop/desktop.cpp, helpviewer/helpwindow.cpp, qfd/fontdisplayer.cpp, scribble/scribble.cpp, and themes/wood.cpp.
|
||
|
.SH "QPoint QRect::bottomLeft () const"
|
||
|
Returns the bottom-left position of the rectangle.
|
||
|
.PP
|
||
|
See also setBottomLeft(), moveBottomLeft(), topRight(), bottom(), and left().
|
||
|
.PP
|
||
|
Example: tictac/tictac.cpp.
|
||
|
.SH "QPoint QRect::bottomRight () const"
|
||
|
Returns the bottom-right position of the rectangle.
|
||
|
.PP
|
||
|
See also setBottomRight(), moveBottomRight(), topLeft(), right(), and bottom().
|
||
|
.PP
|
||
|
Example: tictac/tictac.cpp.
|
||
|
.SH "QPoint QRect::center () const"
|
||
|
Returns the center point of the rectangle.
|
||
|
.PP
|
||
|
See also moveCenter(), topLeft(), bottomRight(), topRight(), and bottomLeft().
|
||
|
.PP
|
||
|
Example: tooltip/tooltip.cpp.
|
||
|
.SH "bool QRect::contains ( const QPoint & p, bool proper = FALSE ) const"
|
||
|
Returns TRUE if the point \fIp\fR is inside or on the edge of the rectangle; otherwise returns FALSE.
|
||
|
.PP
|
||
|
If \fIproper\fR is TRUE, this function returns TRUE only if \fIp\fR is inside (not on the edge).
|
||
|
.PP
|
||
|
Example: t14/cannon.cpp.
|
||
|
.SH "bool QRect::contains ( int x, int y ) const"
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
.PP
|
||
|
Returns TRUE if the point \fIx\fR, \fIy\fR is inside this rectangle; otherwise returns FALSE.
|
||
|
.SH "bool QRect::contains ( int x, int y, bool proper ) const"
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
.PP
|
||
|
Returns TRUE if the point \fIx\fR, \fIy\fR is inside this rectangle; otherwise returns FALSE.
|
||
|
.PP
|
||
|
If \fIproper\fR is TRUE, this function returns TRUE only if the point is entirely inside (not on the edge).
|
||
|
.SH "bool QRect::contains ( const QRect & r, bool proper = FALSE ) const"
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
.PP
|
||
|
Returns TRUE if the rectangle \fIr\fR is inside this rectangle; otherwise returns FALSE.
|
||
|
.PP
|
||
|
If \fIproper\fR is TRUE, this function returns TRUE only if \fIr\fR is entirely inside (not on the edge).
|
||
|
.PP
|
||
|
See also unite(), intersect(), and intersects().
|
||
|
.SH "void QRect::coords ( int * xp1, int * yp1, int * xp2, int * yp2 ) const"
|
||
|
Extracts the rectangle parameters as the top-left point \fI*xp1\fR, \fI*yp1\fR and the bottom-right point \fI*xp2\fR, \fI*yp2\fR.
|
||
|
.PP
|
||
|
See also setCoords() and rect().
|
||
|
.PP
|
||
|
Examples:
|
||
|
.)l themes/metal.cpp and themes/wood.cpp.
|
||
|
.SH "int QRect::height () const"
|
||
|
Returns the height of the rectangle. The height includes both the top and bottom edges, i.e. height = bottom - top + 1.
|
||
|
.PP
|
||
|
See also width(), size(), and setHeight().
|
||
|
.PP
|
||
|
Examples:
|
||
|
.)l aclock/aclock.cpp, desktop/desktop.cpp, movies/main.cpp, scribble/scribble.cpp, themes/metal.cpp, themes/wood.cpp, and xform/xform.cpp.
|
||
|
.SH "QRect QRect::intersect ( const QRect & r ) const"
|
||
|
Returns the intersection of this rectangle and rectangle \fIr\fR. \fCr.intersect(s)\fR is equivalent to \fCr&s\fR.
|
||
|
.SH "bool QRect::intersects ( const QRect & r ) const"
|
||
|
Returns TRUE if this rectangle intersects with rectangle \fIr\fR (there is at least one pixel that is within both rectangles); otherwise returns FALSE.
|
||
|
.PP
|
||
|
See also intersect() and contains().
|
||
|
.PP
|
||
|
Examples:
|
||
|
.)l t11/cannon.cpp, t12/cannon.cpp, t13/cannon.cpp, and t14/cannon.cpp.
|
||
|
.SH "bool QRect::isEmpty () const"
|
||
|
Returns TRUE if the rectangle is empty; otherwise returns FALSE.
|
||
|
.PP
|
||
|
An empty rectangle has a left() > right() or top() > bottom().
|
||
|
.PP
|
||
|
An empty rectangle is not valid. \fCisEmpty() == !isValid()\fR
|
||
|
.PP
|
||
|
See also isNull(), isValid(), and normalize().
|
||
|
.SH "bool QRect::isNull () const"
|
||
|
Returns TRUE if the rectangle is a null rectangle; otherwise returns FALSE.
|
||
|
.PP
|
||
|
A null rectangle has both the width and the height set to 0, that is right() == left() - 1 and bottom() == top() - 1.
|
||
|
.PP
|
||
|
Note that if right() == left() and bottom() == top(), then the rectangle has width 1 and height 1.
|
||
|
.PP
|
||
|
A null rectangle is also empty.
|
||
|
.PP
|
||
|
A null rectangle is not valid.
|
||
|
.PP
|
||
|
See also isEmpty() and isValid().
|
||
|
.SH "bool QRect::isValid () const"
|
||
|
Returns TRUE if the rectangle is valid; otherwise returns FALSE.
|
||
|
.PP
|
||
|
A valid rectangle has a left() <= right() and top() <= bottom().
|
||
|
.PP
|
||
|
Note that non-trivial operations like intersections are not defined for invalid rectangles.
|
||
|
.PP
|
||
|
\fCisValid() == !isEmpty()\fR
|
||
|
.PP
|
||
|
See also isNull(), isEmpty(), and normalize().
|
||
|
.PP
|
||
|
Examples:
|
||
|
.)l themes/metal.cpp and tooltip/tooltip.cpp.
|
||
|
.SH "int QRect::left () const"
|
||
|
Returns the left coordinate of the rectangle. Identical to x().
|
||
|
.PP
|
||
|
See also setLeft(), right(), topLeft(), and bottomLeft().
|
||
|
.PP
|
||
|
Examples:
|
||
|
.)l aclock/aclock.cpp, desktop/desktop.cpp, i18n/main.cpp, scribble/scribble.cpp, tictac/tictac.cpp, and xform/xform.cpp.
|
||
|
.SH "void QRect::moveBottom ( int pos )"
|
||
|
Sets the bottom position of the rectangle to \fIpos\fR, leaving the size unchanged.
|
||
|
.PP
|
||
|
See also bottom(), setBottom(), moveLeft(), moveTop(), and moveRight().
|
||
|
.SH "void QRect::moveBottomLeft ( const QPoint & p )"
|
||
|
Sets the bottom-left position of the rectangle to \fIp\fR, leaving the size unchanged.
|
||
|
.PP
|
||
|
See also bottomLeft(), setBottomLeft(), moveTopLeft(), moveBottomRight(), and moveTopRight().
|
||
|
.PP
|
||
|
Example: t10/cannon.cpp.
|
||
|
.SH "void QRect::moveBottomRight ( const QPoint & p )"
|
||
|
Sets the bottom-right position of the rectangle to \fIp\fR, leaving the size unchanged.
|
||
|
.PP
|
||
|
See also bottomRight(), setBottomRight(), moveTopLeft(), moveTopRight(), and moveBottomLeft().
|
||
|
.SH "void QRect::moveBy ( int dx, int dy )"
|
||
|
Moves the rectangle \fIdx\fR along the x axis and \fIdy\fR along the y axis, relative to the current position. Positive values move the rectangle to the right and down.
|
||
|
.PP
|
||
|
See also moveTopLeft().
|
||
|
.PP
|
||
|
Examples:
|
||
|
.)l action/application.cpp, application/application.cpp, helpviewer/helpwindow.cpp, mdi/application.cpp, themes/wood.cpp, and xform/xform.cpp.
|
||
|
.SH "void QRect::moveCenter ( const QPoint & p )"
|
||
|
Sets the center point of the rectangle to \fIp\fR, leaving the size unchanged.
|
||
|
.PP
|
||
|
See also center(), moveTopLeft(), moveBottomRight(), moveTopRight(), and moveBottomLeft().
|
||
|
.PP
|
||
|
Examples:
|
||
|
.)l t11/cannon.cpp and t12/cannon.cpp.
|
||
|
.SH "void QRect::moveLeft ( int pos )"
|
||
|
Sets the left position of the rectangle to \fIpos\fR, leaving the size unchanged.
|
||
|
.PP
|
||
|
See also left(), setLeft(), moveTop(), moveRight(), and moveBottom().
|
||
|
.SH "void QRect::moveRight ( int pos )"
|
||
|
Sets the right position of the rectangle to \fIpos\fR, leaving the size unchanged.
|
||
|
.PP
|
||
|
See also right(), setRight(), moveLeft(), moveTop(), and moveBottom().
|
||
|
.SH "void QRect::moveTop ( int pos )"
|
||
|
Sets the top position of the rectangle to \fIpos\fR, leaving the size unchanged.
|
||
|
.PP
|
||
|
See also top(), setTop(), moveLeft(), moveRight(), and moveBottom().
|
||
|
.SH "void QRect::moveTopLeft ( const QPoint & p )"
|
||
|
Sets the top-left position of the rectangle to \fIp\fR, leaving the size unchanged.
|
||
|
.PP
|
||
|
See also topLeft(), setTopLeft(), moveBottomRight(), moveTopRight(), and moveBottomLeft().
|
||
|
.PP
|
||
|
Examples:
|
||
|
.)l helpsystem/tooltip.cpp and xform/xform.cpp.
|
||
|
.SH "void QRect::moveTopRight ( const QPoint & p )"
|
||
|
Sets the top-right position of the rectangle to \fIp\fR, leaving the size unchanged.
|
||
|
.PP
|
||
|
See also topRight(), setTopRight(), moveTopLeft(), moveBottomRight(), and moveBottomLeft().
|
||
|
.SH "QRect QRect::normalize () const"
|
||
|
Returns a normalized rectangle, i.e. a rectangle that has a non-negative width and height.
|
||
|
.PP
|
||
|
It swaps left and right if left() > right(), and swaps top and bottom if top() > bottom().
|
||
|
.PP
|
||
|
See also isValid().
|
||
|
.PP
|
||
|
Example: scribble/scribble.cpp.
|
||
|
.SH "QRect QRect::operator& ( const QRect & r ) const"
|
||
|
Returns the intersection of this rectangle and rectangle \fIr\fR.
|
||
|
.PP
|
||
|
Returns an empty rectangle if there is no intersection.
|
||
|
.PP
|
||
|
See also operator&=(), operator|(), isEmpty(), intersects(), and contains().
|
||
|
.SH "QRect & QRect::operator&= ( const QRect & r )"
|
||
|
Intersects this rectangle with rectangle \fIr\fR.
|
||
|
.SH "QRect QRect::operator| ( const QRect & r ) const"
|
||
|
Returns the bounding rectangle of this rectangle and rectangle \fIr\fR.
|
||
|
.PP
|
||
|
The bounding rectangle of a nonempty rectangle and an empty or invalid rectangle is defined to be the nonempty rectangle.
|
||
|
.PP
|
||
|
See also operator|=(), operator&(), intersects(), and contains().
|
||
|
.SH "QRect & QRect::operator|= ( const QRect & r )"
|
||
|
Unites this rectangle with rectangle \fIr\fR.
|
||
|
.SH "QCOORD & QRect::rBottom ()"
|
||
|
Returns a reference to the bottom coordinate of the rectangle.
|
||
|
.PP
|
||
|
See also rLeft(), rTop(), and rRight().
|
||
|
.SH "QCOORD & QRect::rLeft ()"
|
||
|
Returns a reference to the left coordinate of the rectangle.
|
||
|
.PP
|
||
|
See also rTop(), rRight(), and rBottom().
|
||
|
.SH "QCOORD & QRect::rRight ()"
|
||
|
Returns a reference to the right coordinate of the rectangle.
|
||
|
.PP
|
||
|
See also rLeft(), rTop(), and rBottom().
|
||
|
.SH "QCOORD & QRect::rTop ()"
|
||
|
Returns a reference to the top coordinate of the rectangle.
|
||
|
.PP
|
||
|
See also rLeft(), rRight(), and rBottom().
|
||
|
.SH "void QRect::rect ( int * x, int * y, int * w, int * h ) const"
|
||
|
Extracts the rectangle parameters as the position \fI*x\fR, \fI*y\fR and width \fI*w\fR and height \fI*h\fR.
|
||
|
.PP
|
||
|
See also setRect() and coords().
|
||
|
.PP
|
||
|
Examples:
|
||
|
.)l themes/metal.cpp and themes/wood.cpp.
|
||
|
.SH "int QRect::right () const"
|
||
|
Returns the right coordinate of the rectangle.
|
||
|
.PP
|
||
|
See also setRight(), left(), topRight(), and bottomRight().
|
||
|
.PP
|
||
|
Examples:
|
||
|
.)l action/application.cpp, application/application.cpp, customlayout/flow.cpp, desktop/desktop.cpp, scribble/scribble.cpp, t11/cannon.cpp, and themes/wood.cpp.
|
||
|
.SH "void QRect::setBottom ( int pos )"
|
||
|
Sets the bottom edge of the rectangle to \fIpos\fR. May change the height, but will never change the top edge of the rectangle.
|
||
|
.PP
|
||
|
See also bottom(), setTop(), and setHeight().
|
||
|
.PP
|
||
|
Example: scribble/scribble.cpp.
|
||
|
.SH "void QRect::setBottomLeft ( const QPoint & p )"
|
||
|
Set the bottom-left corner of the rectangle to \fIp\fR. May change the size, but will the never change the top-right corner of the rectangle.
|
||
|
.PP
|
||
|
See also bottomLeft(), moveBottomLeft(), setTopLeft(), setBottomRight(), and setTopRight().
|
||
|
.SH "void QRect::setBottomRight ( const QPoint & p )"
|
||
|
Set the bottom-right corner of the rectangle to \fIp\fR. May change the size, but will the never change the top-left corner of the rectangle.
|
||
|
.PP
|
||
|
See also bottomRight(), moveBottomRight(), setTopLeft(), setTopRight(), and setBottomLeft().
|
||
|
.SH "void QRect::setCoords ( int xp1, int yp1, int xp2, int yp2 )"
|
||
|
Sets the coordinates of the rectangle's top-left corner to \fI(xp1, yp1)\fR, and the coordinates of its bottom-right corner to \fI(xp2, yp2)\fR.
|
||
|
.PP
|
||
|
See also coords() and setRect().
|
||
|
.SH "void QRect::setHeight ( int h )"
|
||
|
Sets the height of the rectangle to \fIh\fR. The top edge is not moved, but the bottom edge may be moved.
|
||
|
.PP
|
||
|
See also height(), setTop(), setBottom(), and setSize().
|
||
|
.PP
|
||
|
Example: desktop/desktop.cpp.
|
||
|
.SH "void QRect::setLeft ( int pos )"
|
||
|
Sets the left edge of the rectangle to \fIpos\fR. May change the width, but will never change the right edge of the rectangle.
|
||
|
.PP
|
||
|
Identical to setX().
|
||
|
.PP
|
||
|
See also left(), setTop(), and setWidth().
|
||
|
.PP
|
||
|
Example: scribble/scribble.cpp.
|
||
|
.SH "void QRect::setRect ( int x, int y, int w, int h )"
|
||
|
Sets the coordinates of the rectangle's top-left corner to \fI(x, y)\fR, and its size to \fI(w, h)\fR.
|
||
|
.PP
|
||
|
See also rect() and setCoords().
|
||
|
.PP
|
||
|
Example: themes/wood.cpp.
|
||
|
.SH "void QRect::setRight ( int pos )"
|
||
|
Sets the right edge of the rectangle to \fIpos\fR. May change the width, but will never change the left edge of the rectangle.
|
||
|
.PP
|
||
|
See also right(), setLeft(), and setWidth().
|
||
|
.PP
|
||
|
Example: scribble/scribble.cpp.
|
||
|
.SH "void QRect::setSize ( const QSize & s )"
|
||
|
Sets the size of the rectangle to \fIs\fR. The top-left corner is not moved.
|
||
|
.PP
|
||
|
See also size(), setWidth(), and setHeight().
|
||
|
.PP
|
||
|
Example: xform/xform.cpp.
|
||
|
.SH "void QRect::setTop ( int pos )"
|
||
|
Sets the top edge of the rectangle to \fIpos\fR. May change the height, but will never change the bottom edge of the rectangle.
|
||
|
.PP
|
||
|
Identical to setY().
|
||
|
.PP
|
||
|
See also top(), setBottom(), and setHeight().
|
||
|
.PP
|
||
|
Example: scribble/scribble.cpp.
|
||
|
.SH "void QRect::setTopLeft ( const QPoint & p )"
|
||
|
Set the top-left corner of the rectangle to \fIp\fR. May change the size, but will the never change the bottom-right corner of the rectangle.
|
||
|
.PP
|
||
|
See also topLeft(), moveTopLeft(), setBottomRight(), setTopRight(), and setBottomLeft().
|
||
|
.SH "void QRect::setTopRight ( const QPoint & p )"
|
||
|
Set the top-right corner of the rectangle to \fIp\fR. May change the size, but will the never change the bottom-left corner of the rectangle.
|
||
|
.PP
|
||
|
See also topRight(), moveTopRight(), setTopLeft(), setBottomRight(), and setBottomLeft().
|
||
|
.SH "void QRect::setWidth ( int w )"
|
||
|
Sets the width of the rectangle to \fIw\fR. The right edge is changed, but not the left edge.
|
||
|
.PP
|
||
|
See also width(), setLeft(), setRight(), and setSize().
|
||
|
.PP
|
||
|
Example: desktop/desktop.cpp.
|
||
|
.SH "void QRect::setX ( int x )"
|
||
|
Sets the x position of the rectangle (its left end) to \fIx\fR. May change the width, but will never change the right edge of the rectangle.
|
||
|
.PP
|
||
|
Identical to setLeft().
|
||
|
.PP
|
||
|
See also x() and setY().
|
||
|
.SH "void QRect::setY ( int y )"
|
||
|
Sets the y position of the rectangle (its top) to \fIy\fR. May change the height, but will never change the bottom edge of the rectangle.
|
||
|
.PP
|
||
|
Identical to setTop().
|
||
|
.PP
|
||
|
See also y() and setX().
|
||
|
.SH "QSize QRect::size () const"
|
||
|
Returns the size of the rectangle.
|
||
|
.PP
|
||
|
See also width() and height().
|
||
|
.PP
|
||
|
Examples:
|
||
|
.)l desktop/desktop.cpp, movies/main.cpp, and t10/cannon.cpp.
|
||
|
.SH "int QRect::top () const"
|
||
|
Returns the top coordinate of the rectangle. Identical to y().
|
||
|
.PP
|
||
|
See also setTop(), bottom(), topLeft(), and topRight().
|
||
|
.PP
|
||
|
Examples:
|
||
|
.)l aclock/aclock.cpp, desktop/desktop.cpp, scribble/scribble.cpp, themes/wood.cpp, tictac/tictac.cpp, and xform/xform.cpp.
|
||
|
.SH "QPoint QRect::topLeft () const"
|
||
|
Returns the top-left position of the rectangle.
|
||
|
.PP
|
||
|
See also setTopLeft(), moveTopLeft(), bottomRight(), left(), and top().
|
||
|
.PP
|
||
|
Examples:
|
||
|
.)l helpsystem/tooltip.cpp, t10/cannon.cpp, and tictac/tictac.cpp.
|
||
|
.SH "QPoint QRect::topRight () const"
|
||
|
Returns the top-right position of the rectangle.
|
||
|
.PP
|
||
|
See also setTopRight(), moveTopRight(), bottomLeft(), top(), and right().
|
||
|
.PP
|
||
|
Example: tictac/tictac.cpp.
|
||
|
.SH "QRect QRect::unite ( const QRect & r ) const"
|
||
|
Returns the bounding rectangle of this rectangle and rectangle \fIr\fR. \fCr.unite(s)\fR is equivalent to \fCr|s\fR.
|
||
|
.PP
|
||
|
Examples:
|
||
|
.)l t11/cannon.cpp, t12/cannon.cpp, and xform/xform.cpp.
|
||
|
.SH "int QRect::width () const"
|
||
|
Returns the width of the rectangle. The width includes both the left and right edges, i.e. width = right - left + 1.
|
||
|
.PP
|
||
|
See also height(), size(), and setHeight().
|
||
|
.PP
|
||
|
Examples:
|
||
|
.)l aclock/aclock.cpp, customlayout/border.cpp, desktop/desktop.cpp, movies/main.cpp, themes/metal.cpp, themes/wood.cpp, and xform/xform.cpp.
|
||
|
.SH "int QRect::x () const"
|
||
|
Returns the left coordinate of the rectangle. Identical to left().
|
||
|
.PP
|
||
|
See also left(), y(), and setX().
|
||
|
.PP
|
||
|
Examples:
|
||
|
.)l customlayout/border.cpp, desktop/desktop.cpp, movies/main.cpp, scribble/scribble.cpp, t12/cannon.cpp, themes/metal.cpp, and themes/wood.cpp.
|
||
|
.SH "int QRect::y () const"
|
||
|
Returns the top coordinate of the rectangle. Identical to top().
|
||
|
.PP
|
||
|
See also top(), x(), and setY().
|
||
|
.PP
|
||
|
Examples:
|
||
|
.)l desktop/desktop.cpp, movies/main.cpp, scribble/scribble.cpp, t12/cannon.cpp, t14/cannon.cpp, themes/metal.cpp, and themes/wood.cpp.
|
||
|
.SH RELATED FUNCTION DOCUMENTATION
|
||
|
.SH "bool operator!= ( const QRect & r1, const QRect & r2 )"
|
||
|
Returns TRUE if \fIr1\fR and \fIr2\fR are different; otherwise returns FALSE.
|
||
|
.SH "QDataStream & operator<< ( QDataStream & s, const QRect & r )"
|
||
|
Writes the QRect, \fIr\fR, to the stream \fIs\fR, and returns a reference to the stream.
|
||
|
.PP
|
||
|
See also Format of the QDataStream operators.
|
||
|
.SH "bool operator== ( const QRect & r1, const QRect & r2 )"
|
||
|
Returns TRUE if \fIr1\fR and \fIr2\fR are equal; otherwise returns FALSE.
|
||
|
.SH "QDataStream & operator>> ( QDataStream & s, QRect & r )"
|
||
|
Reads a QRect from the stream \fIs\fR into rect \fIr\fR and returns a reference to the stream.
|
||
|
.PP
|
||
|
See also Format of the QDataStream operators.
|
||
|
|
||
|
.SH "SEE ALSO"
|
||
|
.BR http://doc.trolltech.com/qrect.html
|
||
|
.BR http://www.trolltech.com/faq/tech.html
|
||
|
.SH COPYRIGHT
|
||
|
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
|
||
|
license file included in the distribution for a complete license
|
||
|
statement.
|
||
|
.SH AUTHOR
|
||
|
Generated automatically from the source code.
|
||
|
.SH BUGS
|
||
|
If you find a bug in Qt, please report it as described in
|
||
|
.BR http://doc.trolltech.com/bughowto.html .
|
||
|
Good bug reports help us to help you. Thank you.
|
||
|
.P
|
||
|
The definitive Qt documentation is provided in HTML format; it is
|
||
|
located at $QTDIR/doc/html and can be read using Qt Assistant or with
|
||
|
a web browser. This man page is provided as a convenience for those
|
||
|
users who prefer man pages, although this format is not officially
|
||
|
supported by Trolltech.
|
||
|
.P
|
||
|
If you find errors in this manual page, please report them to
|
||
|
.BR qt-bugs@trolltech.com .
|
||
|
Please include the name of the manual page (qrect.3qt) and the Qt
|
||
|
version (3.3.8).
|