📄 qrect.3qt
字号:
'\" t.TH QRect 3qt "5 August 2004" "Trolltech AS" \" -*- nroff -*-.\" Copyright 1992-2001 Trolltech AS. All rights reserved. See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQRect \- Defines a rectangle in the plane.br.PP\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 "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 * " "x1" ", int * " "y1" ", int * " "x2" ", int * y2 ) const".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 " "x1" ", int " "y1" ", int " "x2" ", int y2 ) ".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" ", bool " "proper" "=FALSE ) 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(Note that these are not member functions.).in +1c.ti -1c.BI "bool \fBoperator==\fR (const QRect & " "r1" ", const QRect & " "r2" ")".br.ti -1c.BI "QDataStream & \fBoperator>>\fR (QDataStream & " "s" ", QRect & " "r" ")".br.ti -1c.BI "QDataStream & \fBoperator<<\fR (QDataStream & " "s" ", const QRect & " "r" ")".br.ti -1c.BI "bool \fBoperator!=\fR (const QRect & " "r1" ", const QRect & " "r2" ")".br.in -1c.SH DESCRIPTIONThe QRect class defines a rectangle in the plane..PPA 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..PPThe 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)..PPNote 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, then the height and the width of the rectangle will both be 1..PPGenerally, \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, where the width and height denote a number of pixels. For example, drawing a rectangle with width and height 1 draws a single pixel..PPThe 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..PPSee also QPoint and QSize..PPExamples:.(lmovies/main.cpp forever/forever.cpp xform/xform.cpp desktop/desktop.cpp.)l.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, left\fR corner and \fIwidth\fR and \fIheight.\fR.PPExample (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 );.fi.SH "int QRect::bottom () const"Returns the bottom coordinate of the rectangle..PPSee also top(), setBottom(), bottomLeft() and bottomRight()..PPExamples:.(ldesktop/desktop.cpp.)l.SH "QPoint QRect::bottomLeft () const"Returns the bottom left position of the rectangle..PPSee also moveBottomLeft(), bottomRight(), topLeft(), topRight(), bottom() and left()..SH "QPoint QRect::bottomRight () const"Returns the bottom right position of the rectangle..PPSee also moveBottomRight(), bottomLeft(), topLeft(), topRight(), bottom() and right()..SH "QPoint QRect::center () const"Returns the center point of the rectangle..PPSee also moveCenter(), topLeft(), topRight(), bottomLeft() and bottomRight()..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..PPIf \fIproper\fR is TRUE, this function returns TRUE only if \fIp\fR is inside (not on the edge)..SH "bool QRect::contains ( const QRect & r, bool proper=FALSE ) const"Returns TRUE if the rectangle \fIr\fR is inside this rectangle..PPIf \fIproper\fR is TRUE, this function returns TRUE only if \fIr\fR is entirely inside (not on the edge)..PPSee also unite(), intersect() and intersects()..SH "bool QRect::contains ( int x, int y, bool proper=FALSE ) const"\\overload bool QRect::contains( const QPoint &p, bool proper ) const..SH "void QRect::coords ( int * xp1, int * yp1, int * xp2, int * yp2 ) const"Extracts the rectangle parameters as the top left point and the bottom right point..PPSee also setCoords() and rect()..SH "int QRect::height () const"Returns the height of the rectangle. The height includes both the top and bottom edges, ie. height = bottom - top + 1..PPSee also width(), size() and setHeight()..PPExamples:.(lmovies/main.cpp xform/xform.cpp desktop/desktop.cpp.)l.SH "QRect QRect::intersect ( const QRect & r ) const".nf.br r.intersect(s).fiis equivalent to.PP.nf.br r&s.fi..SH "bool QRect::intersects ( const QRect & r ) const"Returns TRUE if this rectangle intersects with \fIr\fR (there is at least one pixel which is within both rectangles)..PPSee also intersect() and contains().
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -