Qt 4.8
Public Functions | Properties | Friends | Related Functions | List of all members
QRect Class Reference

The QRect class defines a rectangle in the plane using integer precision. More...

#include <qrect.h>

Public Functions

void adjust (int x1, int y1, int x2, int y2)
 Adds dx1, dy1, dx2 and dy2 respectively to the existing coordinates of the rectangle. More...
 
QRect adjusted (int x1, int y1, int x2, int y2) const
 Returns a new rectangle with dx1, dy1, dx2 and dy2 added respectively to the existing coordinates of this rectangle. More...
 
int bottom () const
 Returns the y-coordinate of the rectangle's bottom edge. More...
 
QPoint bottomLeft () const
 Returns the position of the rectangle's bottom-left corner. More...
 
QPoint bottomRight () const
 Returns the position of the rectangle's bottom-right corner. More...
 
QPoint center () const
 Returns the center point of the rectangle. More...
 
bool contains (const QPoint &p, bool proper=false) const
 Returns true if the given point is inside or on the edge of the rectangle, otherwise returns false. More...
 
bool contains (int x, int y) const
 Returns true if the point (x, y) is inside this rectangle, otherwise returns false. More...
 
bool contains (int x, int y, bool proper) const
 Returns true if the point (x, y) is inside or on the edge of the rectangle, otherwise returns false. More...
 
bool contains (const QRect &r, bool proper=false) const
 Returns true if the given rectangle is inside this rectangle. More...
 
void getCoords (int *x1, int *y1, int *x2, int *y2) const
 Extracts the position of the rectangle's top-left corner to *x1 and *y1, and the position of the bottom-right corner to *x2 and *y2. More...
 
void getRect (int *x, int *y, int *w, int *h) const
 Extracts the position of the rectangle's top-left corner to *x and *y, and its dimensions to *width and *height. More...
 
int height () const
 Returns the height of the rectangle. More...
 
QRect intersect (const QRect &r) const
 Use intersected(rectangle) instead. More...
 
QRect intersected (const QRect &other) const
 Returns the intersection of this rectangle and the given rectangle. More...
 
bool intersects (const QRect &r) const
 Returns true if this rectangle intersects with the given rectangle (i. More...
 
bool isEmpty () const
 Returns true if the rectangle is empty, otherwise returns false. More...
 
bool isNull () const
 Returns true if the rectangle is a null rectangle, otherwise returns false. More...
 
bool isValid () const
 Returns true if the rectangle is valid, otherwise returns false. More...
 
int left () const
 Returns the x-coordinate of the rectangle's left edge. More...
 
void moveBottom (int pos)
 Moves the rectangle vertically, leaving the rectangle's bottom edge at the given y coordinate. More...
 
void moveBottomLeft (const QPoint &p)
 Moves the rectangle, leaving the bottom-left corner at the given position. More...
 
void moveBottomRight (const QPoint &p)
 Moves the rectangle, leaving the bottom-right corner at the given position. More...
 
void moveCenter (const QPoint &p)
 Moves the rectangle, leaving the center point at the given position. More...
 
void moveLeft (int pos)
 Moves the rectangle horizontally, leaving the rectangle's left edge at the given x coordinate. More...
 
void moveRight (int pos)
 Moves the rectangle horizontally, leaving the rectangle's right edge at the given x coordinate. More...
 
void moveTo (int x, int t)
 Moves the rectangle, leaving the top-left corner at the given position (x, y). More...
 
void moveTo (const QPoint &p)
 Moves the rectangle, leaving the top-left corner at the given position. More...
 
void moveTop (int pos)
 Moves the rectangle vertically, leaving the rectangle's top edge at the given y coordinate. More...
 
void moveTopLeft (const QPoint &p)
 Moves the rectangle, leaving the top-left corner at the given position. More...
 
void moveTopRight (const QPoint &p)
 Moves the rectangle, leaving the top-right corner at the given position. More...
 
QRect normalized () const
 Returns a normalized rectangle; i.e., a rectangle that has a non-negative width and height. More...
 
QRect operator & (const QRect &r) const
 
QRectoperator &= (const QRect &r)
 
QRect operator| (const QRect &r) const
 Returns the bounding rectangle of this rectangle and the given rectangle. More...
 
QRectoperator|= (const QRect &r)
 Unites this rectangle with the given rectangle. More...
 
 QRect ()
 Constructs a null rectangle. More...
 
 QRect (const QPoint &topleft, const QPoint &bottomright)
 Constructs a rectangle with the given topLeft and bottomRight corners. More...
 
 QRect (const QPoint &topleft, const QSize &size)
 Constructs a rectangle with the given topLeft corner and the given size. More...
 
 QRect (int left, int top, int width, int height)
 Constructs a rectangle with (x, y) as its top-left corner and the given width and height. More...
 
int right () const
 Returns the x-coordinate of the rectangle's right edge. More...
 
void setBottom (int pos)
 Sets the bottom edge of the rectangle to the given y coordinate. More...
 
void setBottomLeft (const QPoint &p)
 Set the bottom-left corner of the rectangle to the given position. More...
 
void setBottomRight (const QPoint &p)
 Set the bottom-right corner of the rectangle to the given position. More...
 
void setCoords (int x1, int y1, int x2, int y2)
 Sets the coordinates of the rectangle's top-left corner to (x1, y1), and the coordinates of its bottom-right corner to (x2, y2). More...
 
void setHeight (int h)
 Sets the height of the rectangle to the given height. More...
 
void setLeft (int pos)
 Sets the left edge of the rectangle to the given x coordinate. More...
 
void setRect (int x, int y, int w, int h)
 Sets the coordinates of the rectangle's top-left corner to ({x}, {y}), and its size to the given width and height. More...
 
void setRight (int pos)
 Sets the right edge of the rectangle to the given x coordinate. More...
 
void setSize (const QSize &s)
 Sets the size of the rectangle to the given size. More...
 
void setTop (int pos)
 Sets the top edge of the rectangle to the given y coordinate. More...
 
void setTopLeft (const QPoint &p)
 Set the top-left corner of the rectangle to the given position. More...
 
void setTopRight (const QPoint &p)
 Set the top-right corner of the rectangle to the given position. More...
 
void setWidth (int w)
 Sets the width of the rectangle to the given width. More...
 
void setX (int x)
 Sets the left edge of the rectangle to the given x coordinate. More...
 
void setY (int y)
 Sets the top edge of the rectangle to the given y coordinate. More...
 
QSize size () const
 Returns the size of the rectangle. More...
 
int top () const
 Returns the y-coordinate of the rectangle's top edge. More...
 
QPoint topLeft () const
 Returns the position of the rectangle's top-left corner. More...
 
QPoint topRight () const
 Returns the position of the rectangle's top-right corner. More...
 
void translate (int dx, int dy)
 Moves the rectangle dx along the x axis and dy along the y axis, relative to the current position. More...
 
void translate (const QPoint &p)
 Moves the rectangle {offset}. More...
 
QRect translated (int dx, int dy) const
 Returns a copy of the rectangle that is translated dx along the x axis and dy along the y axis, relative to the current position. More...
 
QRect translated (const QPoint &p) const
 Returns a copy of the rectangle that is translated {offset}. More...
 
QRect unite (const QRect &r) const
 Use united(rectangle) instead. More...
 
QRect united (const QRect &other) const
 Returns the bounding rectangle of this rectangle and the given rectangle. More...
 
int width () const
 Returns the width of the rectangle. More...
 
int x () const
 Returns the x-coordinate of the rectangle's left edge. More...
 
int y () const
 Returns the y-coordinate of the rectangle's top edge. More...
 

Properties

int x1
 
int x2
 
int y1
 
int y2
 

Friends

Q_CORE_EXPORT_INLINE bool operator!= (const QRect &, const QRect &)
 Returns true if the rectangles r1 and r2 are different, otherwise returns false. More...
 
Q_CORE_EXPORT_INLINE bool operator== (const QRect &, const QRect &)
 Returns true if the rectangles r1 and r2 are equal, otherwise returns false. More...
 
void qt_setCoords (QRect *r, int xp1, int yp1, int xp2, int yp2)
 

Related Functions

(Note that these are not member functions.)

QDataStreamoperator<< (QDataStream &stream, const QRect &rectangle)
 Writes the given rectangle to the given stream, and returns a reference to the stream. More...
 
QDataStreamoperator>> (QDataStream &stream, QRect &rectangle)
 Reads a rectangle from the given stream into the given rectangle, and returns a reference to the stream. More...
 

Detailed Description

The QRect class defines a rectangle in the plane using integer precision.

A rectangle is normally expressed as an upper-left corner and a size. The size (width and height) of a QRect is always equivalent to the mathematical rectangle that forms the basis for its rendering.

A QRect can be constructed with a set of left, top, width and height integers, or from a QPoint and a QSize. The following code creates two identical rectangles.

QRect r1(100, 200, 11, 16);
QRect r2(QPoint(100, 200), QSize(11, 16));

There is a third constructor that creates a QRect using the top-left and bottom-right coordinates, but we recommend that you avoid using it. The rationale is that for historical reasons the values returned by the bottom() and right() functions deviate from the true bottom-right corner of the rectangle.

The QRect class provides a collection of functions that return the various rectangle coordinates, and enable manipulation of these. QRect also provide functions to move the rectangle relative to the various coordinates. In addition there is a moveTo() function that moves the rectangle, leaving its top left corner at the given coordinates. Alternatively, the translate() function moves the rectangle the given offset relative to the current position, and the translated() function returns a translated copy of this rectangle.

The size() function returns the rectange's dimensions as a QSize. The dimensions can also be retrieved separately using the width() and height() functions. To manipulate the dimensions use the setSize(), setWidth() or setHeight() functions. Alternatively, the size can be changed by applying either of the functions setting the rectangle coordinates, for example, setBottom() or setRight().

The contains() function tells whether a given point is inside the rectangle or not, and the intersects() function returns true if this rectangle intersects with a given rectangle. The QRect class also provides the intersected() function which returns the intersection rectangle, and the united() function which returns the rectangle that encloses the given rectangle and this:

qrect-intersect.png
qrect-unite.png
intersected() united()

The isEmpty() function returns true if left() > right() or top() > bottom(). Note that an empty rectangle is not valid: The isValid() function returns true if left() <= right() and top() <= bottom(). A null rectangle (isNull() == true) on the other hand, has both width and height set to 0.

Note that due to the way QRect and QRectF are defined, an empty QRect is defined in essentially the same way as QRectF.

Finally, QRect objects can be streamed as well as compared.

Rendering

When using an QPainter::Antialiasing{anti-aliased} painter, the boundary line of a QRect will be rendered symmetrically on both sides of the mathematical rectangle's boundary line. But when using an aliased painter (the default) other rules apply.

Then, when rendering with a one pixel wide pen the QRect's boundary line will be rendered to the right and below the mathematical rectangle's boundary line.

When rendering with a two pixels wide pen the boundary line will be split in the middle by the mathematical rectangle. This will be the case whenever the pen is set to an even number of pixels, while rendering with a pen with an odd number of pixels, the spare pixel will be rendered to the right and below the mathematical rectangle as in the one pixel case.

qrect-diagram-zero.png
qrect-diagram-one.png
Logical representation One pixel wide pen
qrect-diagram-two.png
qrect-diagram-three.png
Two pixel wide pen Three pixel wide pen

Coordinates

The QRect class provides a collection of functions that return the various rectangle coordinates, and enable manipulation of these. QRect also provide functions to move the rectangle relative to the various coordinates.

For example the left(), setLeft() and moveLeft() functions as an example: left() returns the x-coordinate of the rectangle's left edge, setLeft() sets the left edge of the rectangle to the given x coordinate (it may change the width, but will never change the rectangle's right edge) and moveLeft() moves the entire rectangle horizontally, leaving the rectangle's left edge at the given x coordinate and its size unchanged.

qrect-coordinates.png

Note that for historical reasons the values returned by the bottom() and right() functions deviate from the true bottom-right corner of the rectangle: The right() function returns { left()

We recommend that you use x() + width() and y() + height() to find the true bottom-right corner, and avoid right() and bottom(). Another solution is to use QRectF: The QRectF class defines a rectangle in the plane using floating point accuracy for coordinates, and the QRectF::right() and QRectF::bottom() functions do return the right and bottom coordinates.

It is also possible to add offsets to this rectangle's coordinates using the adjust() function, as well as retrieve a new rectangle based on adjustments of the original one using the adjusted() function. If either of the width and height is negative, use the normalized() function to retrieve a rectangle where the corners are swapped.

In addition, QRect provides the getCoords() function which extracts the position of the rectangle's top-left and bottom-right corner, and the getRect() function which extracts the rectangle's top-left corner, width and height. Use the setCoords() and setRect() function to manipulate the rectangle's coordinates and dimensions in one go.

See also
QRectF, QRegion

Definition at line 58 of file qrect.h.

Constructors and Destructors

◆ QRect() [1/4]

QRect::QRect ( )
inline

Constructs a null rectangle.

See also
isNull()

Definition at line 61 of file qrect.h.

Referenced by adjusted(), operator|(), QRectF::toAlignedRect(), and translated().

61 { x1 = y1 = 0; x2 = y2 = -1; }
int y1
Definition: qrect.h:177
int y2
Definition: qrect.h:179
int x2
Definition: qrect.h:180
int x1
Definition: qrect.h:178

◆ QRect() [2/4]

QRect::QRect ( const QPoint topLeft,
const QPoint bottomRight 
)
inline

Constructs a rectangle with the given topLeft and bottomRight corners.

See also
setTopLeft(), setBottomRight()

Definition at line 215 of file qrect.h.

216 {
217  x1 = atopLeft.x();
218  y1 = atopLeft.y();
219  x2 = abottomRight.x();
220  y2 = abottomRight.y();
221 }
int y1
Definition: qrect.h:177
int y2
Definition: qrect.h:179
int x2
Definition: qrect.h:180
int x1
Definition: qrect.h:178

◆ QRect() [3/4]

QRect::QRect ( const QPoint topLeft,
const QSize size 
)
inline

Constructs a rectangle with the given topLeft corner and the given size.

See also
setTopLeft(), setSize()

Definition at line 223 of file qrect.h.

224 {
225  x1 = atopLeft.x();
226  y1 = atopLeft.y();
227  x2 = (x1+asize.width() - 1);
228  y2 = (y1+asize.height() - 1);
229 }
int y1
Definition: qrect.h:177
int y2
Definition: qrect.h:179
int x2
Definition: qrect.h:180
int x1
Definition: qrect.h:178

◆ QRect() [4/4]

QRect::QRect ( int  x,
int  y,
int  width,
int  height 
)
inline

Constructs a rectangle with (x, y) as its top-left corner and the given width and height.

See also
setRect()

Definition at line 207 of file qrect.h.

208 {
209  x1 = aleft;
210  y1 = atop;
211  x2 = (aleft + awidth - 1);
212  y2 = (atop + aheight - 1);
213 }
int y1
Definition: qrect.h:177
int y2
Definition: qrect.h:179
int x2
Definition: qrect.h:180
int x1
Definition: qrect.h:178

Functions

◆ adjust()

void QRect::adjust ( int  dx1,
int  dy1,
int  dx2,
int  dy2 
)
inline

Adds dx1, dy1, dx2 and dy2 respectively to the existing coordinates of the rectangle.

See also
adjusted(), setRect()

Definition at line 434 of file qrect.h.

Referenced by _q_adjustRect(), QRectF::bottomLeft(), QDeclarativeText::boundingRect(), QRenderRule::boxRect(), QMacStylePrivate::comboboxEditBounds(), QGridLayoutPrivate::distribute(), do_size_hints(), dockedGeometry(), QLabelPrivate::documentRect(), QItemDelegate::doLayout(), QListModeViewBase::doStaticLayout(), QListModeViewBase::dragMoveEvent(), QCommonStyle::drawComplexControl(), QWindowsCEStyle::drawComplexControl(), QWindowsMobileStyle::drawComplexControl(), QCleanlooksStyle::drawComplexControl(), QWindowsStyle::drawComplexControl(), QWindowsXPStyle::drawComplexControl(), QGtkStyle::drawComplexControl(), QMotifStyle::drawComplexControl(), QMacStyle::drawComplexControl(), QWindowsVistaStyle::drawControl(), QCommonStyle::drawControl(), QWindowsMobileStyle::drawControl(), QPlastiqueStyle::drawControl(), QCleanlooksStyle::drawControl(), QWindowsXPStyle::drawControl(), QGtkStyle::drawControl(), QMacStyle::drawControl(), QGraphicsScenePrivate::drawItemHelper(), QPlastiqueStylePrivate::drawPartialFrame(), QWindowsCEStyle::drawPrimitive(), QCommonStyle::drawPrimitive(), QWindowsMobileStyle::drawPrimitive(), QPlastiqueStyle::drawPrimitive(), QCleanlooksStyle::drawPrimitive(), QWindowsXPStyle::drawPrimitive(), QWindowsStyle::drawPrimitive(), QGtkStyle::drawPrimitive(), QWindowsMobileStylePrivate::drawScrollbarGrip(), QWindowsMobileStylePrivate::drawScrollbarHandleDown(), QWindowsMobileStylePrivate::drawScrollbarHandleUp(), QGraphicsScenePrivate::drawSubtreeRecursive(), QListModeViewBase::dropOn(), QScrollArea::ensureWidgetVisible(), QIconModeViewBase::filterStartDrag(), QDockAreaLayoutInfo::findSeparator(), QDockAreaLayout::findSeparator(), QAbstractScrollAreaPrivate::layoutChildren(), QMenuBarPrivate::menuRect(), QScrollBar::mouseMoveEvent(), QDockWidgetPrivate::nonClientAreaMouseEvent(), QPdfBaseEnginePrivate::pageRect(), QColumnViewDelegate::paint(), QLabel::paintEvent(), QPagePreview::paintEvent(), QWhatsThat::paintEvent(), QGraphicsWidget::paintWindowFrame(), QMainWindowLayout::plug(), QAbstractItemViewPrivate::position(), QListModeViewBase::position(), QListViewPrivate::prepareItemsLayout(), QMacPrintEngine::property(), QAccessibleItemView::rect(), QToolBarAreaLayout::rectHint(), setCoords(), QDeclarativeTextInput::setCursorPosition(), QFrame::setFrameRect(), QFormLayout::setGeometry(), QDockWidgetLayout::setGeometry(), setLayoutItemMargins(), QMdiSubWindowPrivate::setMaximizeMode(), QTabBarPrivate::setupMovableTab(), QAbstractItemView::startDrag(), QCommonStyle::subControlRect(), QWindowsVistaStyle::subControlRect(), QPlastiqueStyle::subControlRect(), QWindowsXPStyle::subControlRect(), QWindowsMobileStyle::subControlRect(), QCleanlooksStyle::subControlRect(), QMotifStyle::subControlRect(), QMacStyle::subControlRect(), QGtkStyle::subControlRect(), QCommonStyle::subElementRect(), QWindowsVistaStyle::subElementRect(), QCleanlooksStyle::subElementRect(), QWindowsXPStyle::subElementRect(), QWindowsMobileStyle::subElementRect(), QWindowsStyle::subElementRect(), QMacStyle::subElementRect(), QMotifStyle::subElementRect(), QDockAreaLayoutInfo::tabContentRect(), QCommonStylePrivate::tabLayout(), QPlainTextEdit::timerEvent(), QTextEdit::timerEvent(), QDockWidgetPrivate::unplug(), QStyledItemDelegate::updateEditorGeometry(), QFramePrivate::updateFrameWidth(), QGraphicsViewPrivate::updateRegion(), and QGraphicsView::updateScene().

435 {
436  x1 += dx1;
437  y1 += dy1;
438  x2 += dx2;
439  y2 += dy2;
440 }
int y1
Definition: qrect.h:177
int y2
Definition: qrect.h:179
int x2
Definition: qrect.h:180
int x1
Definition: qrect.h:178

◆ adjusted()

QRect QRect::adjusted ( int  dx1,
int  dy1,
int  dx2,
int  dy2 
) const
inline

Returns a new rectangle with dx1, dy1, dx2 and dy2 added respectively to the existing coordinates of this rectangle.

See also
adjust()

Definition at line 431 of file qrect.h.

Referenced by QRenderRule::borderRect(), QRectF::bottomLeft(), QGraphicsItem::boundingRegion(), QRenderRule::contentsRect(), QOpenGLPaintEnginePrivate::copyDrawable(), QWindowsXPStylePrivate::drawBackgroundDirectly(), QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(), QWindowsVistaStyle::drawComplexControl(), QCommonStyle::drawComplexControl(), QWindowsCEStyle::drawComplexControl(), QPlastiqueStyle::drawComplexControl(), QWindowsMobileStyle::drawComplexControl(), QCleanlooksStyle::drawComplexControl(), QWindowsStyle::drawComplexControl(), QWindowsXPStyle::drawComplexControl(), QGtkStyle::drawComplexControl(), QMotifStyle::drawComplexControl(), QMacStyle::drawComplexControl(), QSplashScreen::drawContents(), QWindowsVistaStyle::drawControl(), QCommonStyle::drawControl(), QWindowsCEStyle::drawControl(), QCDEStyle::drawControl(), QWindowsMobileStyle::drawControl(), QPlastiqueStyle::drawControl(), QCleanlooksStyle::drawControl(), QWindowsXPStyle::drawControl(), QWindowsStyle::drawControl(), QGtkStyle::drawControl(), QMotifStyle::drawControl(), QMacStyle::drawControl(), QStyleSheetStyle::drawControl(), QItemDelegate::drawDisplay(), QGraphicsScenePrivate::drawItemHelper(), QGraphicsScenePrivate::drawItems(), QStyle::drawItemText(), QWindowsMobileStylePrivate::drawPanelItemViewSelected(), QWindowsCEStyle::drawPrimitive(), QWindowsVistaStyle::drawPrimitive(), QCommonStyle::drawPrimitive(), QWindowsMobileStyle::drawPrimitive(), QPlastiqueStyle::drawPrimitive(), QCleanlooksStyle::drawPrimitive(), QWindowsXPStyle::drawPrimitive(), QWindowsStyle::drawPrimitive(), QGtkStyle::drawPrimitive(), QMacStyle::drawPrimitive(), QStyleSheetStyle::drawPrimitive(), QWindowsMobileStylePrivate::drawScrollbarGrip(), QWindowsMobileStylePrivate::drawScrollbarHandleDown(), QWindowsMobileStylePrivate::drawScrollbarHandleUp(), QWindowsMobileStylePrivate::drawTabBarTab(), QGraphicsViewPrivate::findItems(), QGraphicsView::fitInView(), QToolBarAreaLayout::fitLayout(), fromLayoutItemRect(), QGraphicsView::mapToScene(), QListViewPrivate::mapToViewport(), QWorkspaceTitleBar::mouseMoveEvent(), QWorkspaceTitleBar::mousePressEvent(), QWorkspaceTitleBar::mouseReleaseEvent(), QRenderRule::outlineRect(), QRenderRule::paddingRect(), QDeclarativePaintedItem::paint(), QWellArray::paintCell(), QFocusFrame::paintEvent(), QStatusBar::paintEvent(), QPagePreview::paintEvent(), QTabBar::paintEvent(), QGraphicsWidget::paintWindowFrame(), QStyleSheetStyle::positionRect(), QGLPixmapBlurFilter::processGL(), QWin32PrintEngine::property(), qstring_to_xtp(), qt_cleanlooks_draw_mdibutton(), qt_plastique_draw_mdibutton(), qt_plastique_drawShadedPanel(), QGraphicsView::render(), QCommonStyle::styleHint(), QWindowsStyle::styleHint(), QCommonStyle::subControlRect(), QPlastiqueStyle::subControlRect(), QWindowsMobileStyle::subControlRect(), QWindowsCEStyle::subControlRect(), QCleanlooksStyle::subControlRect(), QMacStyle::subControlRect(), QGtkStyle::subControlRect(), QStyleSheetStyle::subControlRect(), QCommonStyle::subElementRect(), QWindowsVistaStyle::subElementRect(), QPlastiqueStyle::subElementRect(), QWindowsXPStyle::subElementRect(), QGtkStyle::subElementRect(), QCommandLinkButtonPrivate::titleRect(), toLayoutItemRect(), QGraphicsViewPrivate::updateRectF(), QDockAreaLayoutInfo::updateSeparatorWidgets(), QDockAreaLayout::updateSeparatorWidgets(), QCommonListViewBase::verticalScrollToValue(), and QCommonStylePrivate::viewItemDrawText().

432 { return QRect(QPoint(x1 + xp1, y1 + yp1), QPoint(x2 + xp2, y2 + yp2)); }
int y1
Definition: qrect.h:177
int y2
Definition: qrect.h:179
QRect()
Constructs a null rectangle.
Definition: qrect.h:61
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
int x2
Definition: qrect.h:180
int x1
Definition: qrect.h:178

◆ bottom()

int QRect::bottom ( ) const
inline

Returns the y-coordinate of the rectangle's bottom edge.

Note that for historical reasons this function returns top() + height() - 1; use y() + height() to retrieve the true y-coordinate.

See also
setBottom(), bottomLeft(), bottomRight()

Definition at line 249 of file qrect.h.

Referenced by QTextEditPrivate::_q_ensureVisible(), _q_interpolate(), QSpanBuffer::addSpan(), QLineEditPrivate::adjustedContentsRect(), QmlJSDebugger::QDeclarativeViewInspector::adjustToScreenBoundaries(), QRasterPaintEngine::alphaPenBlt(), QWidgetAnimator::animate(), QPlainTextEditPrivate::append(), QRegionPrivate::append(), QDockAreaLayoutInfo::apply(), QToolBarAreaLayout::apply(), blitTexture(), QVGCompositionHelper::blitWindow(), QGroupBoxPrivate::calculateFrame(), canMergeFromBelow(), canMergeFromRight(), QRegionPrivate::canPrepend(), QComboBox::changeEvent(), clearRect(), QBspTree::climbTree(), clipStraightLine(), QListViewPrivate::closestIndex(), constrainedRect(), QRegionPrivate::contains(), containsViewport(), convolute(), correctNormalized(), QToolBarAreaLayoutInfo::distance(), QGridLayoutPrivate::distribute(), QAbstractItemView::doAutoScroll(), QLabelPrivate::documentRect(), QIconModeViewBase::doDynamicLayout(), QListModeViewBase::doStaticLayout(), QAbstractItemView::dragMoveEvent(), QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(), QPlastiqueStyle::drawComplexControl(), QCleanlooksStyle::drawComplexControl(), QWindowsXPStyle::drawComplexControl(), QGtkStyle::drawComplexControl(), QMotifStyle::drawComplexControl(), QWindowsCEStyle::drawControl(), QWindowsVistaStyle::drawControl(), QCommonStyle::drawControl(), QWindowsMobileStyle::drawControl(), QPlastiqueStyle::drawControl(), QCleanlooksStyle::drawControl(), QWindowsXPStyle::drawControl(), QWindowsStyle::drawControl(), QGtkStyle::drawControl(), QMotifStyle::drawControl(), QMacStyle::drawControl(), QStyleSheetStyle::drawControl(), QGLTrapezoidMaskGenerator::drawMask(), drawPixel(), drawPixelARGB32(), drawPixelARGB32Opaque(), QWindowsCEStyle::drawPrimitive(), QWindowsVistaStyle::drawPrimitive(), QCommonStyle::drawPrimitive(), QWindowsMobileStyle::drawPrimitive(), QPlastiqueStyle::drawPrimitive(), QCleanlooksStyle::drawPrimitive(), QWindowsXPStyle::drawPrimitive(), QWindowsStyle::drawPrimitive(), QGtkStyle::drawPrimitive(), QMotifStyle::drawPrimitive(), QMacStyle::drawPrimitive(), QWindowsMobileStylePrivate::drawScrollbarGrip(), QDirectFBPaintEnginePrivate::drawTiledPixmap(), drawToolbarButtonArrow(), QTreeView::drawTree(), QBoxLayoutPrivate::effectiveMargins(), QGridLayoutPrivate::effectiveMargins(), effectiveState(), QPSPrintEnginePrivate::emitHeader(), QPlainTextEditPrivate::ensureCursorVisible(), QScrollArea::ensureWidgetVisible(), QDockWidget::event(), QQnxScreen::exposeRegion(), QScriptEdit::extraAreaPaintEvent(), QRasterPaintEngine::fillPath(), QOpenGLPaintEnginePrivate::fillVertexArray(), QToolBarAreaLayoutInfo::fitLayout(), QToolBarAreaLayout::fitLayout(), QDirectFBScreen::flipSurface(), QDirectFbWindowSurface::flush(), QWidgetPrivate::frameStrut(), QDockAreaLayout::gapIndex(), QMdi::MinOverlapPlacer::getCandidatePlacements(), QDockAreaLayout::getGrid(), grayscale(), QRegionPrivate::intersect(), QListModeViewBase::intersectingSet(), intersectsViewport(), isEmptyHelper(), isServerProcess(), QRasterPaintEnginePrivate::isUnclipped(), QRasterPaintEnginePrivate::isUnclipped_normalized(), QWidgetResizeHandler::keyPressEvent(), QAbstractScrollAreaPrivate::layoutChildren(), QTabBarPrivate::layoutTabs(), make_win_eventUPP(), QTabBarPrivate::makeVisible(), QTransformedScreen::mapFromDevice(), QMatrix::mapRect(), QTransform::mapRect(), QTransformedScreen::mapToDevice(), QRegionPrivate::mergeFromBelow(), miCoalesce(), miRegionOp(), miSetExtents(), QWidgetResizeHandler::mouseMoveEvent(), QComboBoxPrivateScroller::mouseMoveEvent(), QSizeGrip::mousePressEvent(), QListView::moveCursor(), QAbstractButtonPrivate::moveFocus(), QAccessibleWidget::navigate(), QDockWidgetPrivate::nonClientAreaMouseEvent(), operator<<(), QRectF::operator|(), QVistaBackButton::paintEvent(), QTableView::paintEvent(), QTabBar::paintEvent(), QHeaderView::paintEvent(), QLineEdit::paintEvent(), QPlainTextEdit::paintEvent(), QSliderPrivate::pixelPosToRangeValue(), QScrollBarPrivate::pixelPosToRangeValue(), QWorkspacePrivate::place(), QWidgetPrivate::pointToRect(), PolygonRegion(), QMenu::popup(), QMenuBarPrivate::popupAction(), QToolButtonPrivate::popupTimerDone(), QAbstractItemViewPrivate::position(), QDateTimeEditPrivate::positionCalendarPopup(), QRegionPrivate::prepend(), PtsToRegion(), qDrawBorderPixmap(), QRect_unite(), qRectIntersects(), qstring_to_xtp(), qt_cleanlooks_draw_buttongradient(), qt_cleanlooks_draw_gradient(), qt_cleanlooks_draw_mdibutton(), qt_grab_cursor(), qt_intersect_spans(), qt_mac_create_window(), qt_mac_unregister_widget(), qt_plastique_draw_frame(), qt_plastique_draw_gradient(), qt_plastique_draw_mdibutton(), qt_plastique_drawFrame(), qt_rect_intersect_normalized(), qt_region_strictContains(), QtWndProc(), QGLMaskTextureCache::quadtreeClear(), QGLMaskTextureCache::quadtreeInsert(), QVNCScreenPrivate::QVNCScreenPrivate(), QRasterizer::rasterize(), QRasterizer::rasterizeLine(), read_jpeg_image(), QMdi::RegularTiler::rearrange(), rect_intersects(), RectInRegion(), QDecorationDefault::region(), QWidget::restoreGeometry(), QListViewPrivate::scrollElasticBandBy(), QMenuPrivate::scrollMenu(), scrollSurface(), QTreeView::scrollTo(), QPageSetupWidget::selectPrinter(), QDockAreaLayout::separatorRect(), QVNCScreenPrivate::setDirty(), QWidget::setDisabled(), QFrame::setFrameRect(), QBoxLayout::setGeometry(), QDockWidgetLayout::setGeometry(), QMainWindowLayout::setGeometry(), QWidgetPrivate::setGeometry_sys(), QDockAreaLayout::setGrid(), QWidgetPrivate::setLayoutItemMargins(), QRegion::setRects(), QTableView::setSelection(), QListView::setSelection(), QTreeView::setSelection(), QWidget::setWindowState(), QAbstractItemViewPrivate::shouldAutoScroll(), QCompleterPrivate::showPopup(), QComboBox::showPopup(), showYellowThing_win(), QMenu::sizeHint(), QPlastiqueStyle::styleHint(), QPlastiqueStyle::subControlRect(), QWindowsXPStyle::subControlRect(), QMacStyle::subControlRect(), QCommonStyle::subElementRect(), QMacStyle::subElementRect(), QMotifStyle::subElementRect(), QPlainTextEdit::timerEvent(), QTextEdit::timerEvent(), QTest::toString(), UnionRegion(), QXIMInputContext::update(), QDirectFBPaintEnginePrivate::updateClip(), QOpenGLPaintEnginePrivate::updateDepthClip(), updateRedirectedToGraphicsProxyWidget(), QFramePrivate::updateStyledFrameWidths(), QWorkspacePrivate::updateWorkspace(), useScrollBar(), QCommonListViewBase::verticalScrollToValue(), QListViewPrivate::verticalScrollToValue(), QTreeView::visualRegionForSelection(), and QRegionPrivate::within().

250 { return y2; }
int y2
Definition: qrect.h:179

◆ bottomLeft()

QPoint QRect::bottomLeft ( ) const
inline

◆ bottomRight()

QPoint QRect::bottomRight ( ) const
inline

Returns the position of the rectangle's bottom-right corner.

Note that for historical reasons this function returns QPoint(left() + width() -1, top() + height() - 1).

See also
setBottomRight(), bottom(), right()

Definition at line 291 of file qrect.h.

Referenced by QTransformedScreen::blit(), QMultiScreen::createSurface(), QIconModeViewBase::doDynamicLayout(), QWidgetResizeHandler::doMove(), QSplitterPrivate::doMove(), QWidgetResizeHandler::doResize(), QListModeViewBase::doStaticLayout(), QPlastiqueStyle::drawComplexControl(), QCleanlooksStyle::drawComplexControl(), QStyleSheetStyle::drawComplexControl(), QWindowsCEStyle::drawControl(), QPlastiqueStyle::drawControl(), QWindowsMobileStyle::drawControl(), QCleanlooksStyle::drawControl(), QWindowsStyle::drawControl(), QMacStyle::drawControl(), QPlastiqueStylePrivate::drawPartialFrame(), QCommonStyle::drawPrimitive(), QWindowsMobileStyle::drawPrimitive(), QPlastiqueStyle::drawPrimitive(), QCleanlooksStyle::drawPrimitive(), QGtkStyle::drawPrimitive(), QMacStyle::drawPrimitive(), QWindowsMobileStylePrivate::drawScrollbarGrip(), QWindowsMobileStylePrivate::drawScrollbarHandleDown(), QWindowsMobileStylePrivate::drawScrollbarHandleUp(), QWindowsMobileStylePrivate::drawTabBarTab(), QWidgetResizeHandler::eventFilter(), QAbstractScrollAreaPrivate::layoutChildren(), QWidgetResizeHandler::mouseMoveEvent(), QWellArray::paintCellContents(), QPlainTextEdit::paintEvent(), QToolButtonPrivate::popupTimerDone(), QRectF::QRectF(), qt_mac_update_widget_position(), QRasterizer::rasterizeLine(), QAccessibleTextEdit::scrollToSubstring(), QToolBarLayout::setGeometry(), QCompleterPrivate::showPopup(), QPlastiqueStyle::styleHint(), QMotifStyle::subControlRect(), QStyleSheetStyle::subControlRect(), and QDesktopWidgetPrivate::updateScreenList().

292 { return QPoint(x2, y2); }
int y2
Definition: qrect.h:179
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
int x2
Definition: qrect.h:180

◆ center()

QPoint QRect::center ( ) const
inline

Returns the center point of the rectangle.

See also
moveCenter()

Definition at line 300 of file qrect.h.

Referenced by QRectF::bottomLeft(), QGraphicsViewPrivate::centerView(), QComboBox::changeEvent(), QListViewPrivate::closestIndex(), QDialog::contextMenuEvent(), QPlastiqueStyle::drawComplexControl(), QCleanlooksStyle::drawComplexControl(), QWindowsXPStyle::drawComplexControl(), QGtkStyle::drawComplexControl(), QWindowsCEStyle::drawControl(), QWindowsVistaStyle::drawControl(), QPlastiqueStyle::drawControl(), QCleanlooksStyle::drawControl(), QWindowsStyle::drawControl(), QGtkStyle::drawControl(), QMotifStyle::drawControl(), QStyleSheetStyle::drawControl(), QWindowsVistaStyle::drawPrimitive(), QPlastiqueStyle::drawPrimitive(), QWindowsStyle::drawPrimitive(), QGtkStyle::drawPrimitive(), QMacStyle::drawPrimitive(), QWindowsMobileStylePrivate::drawScrollbarGrip(), QPlainTextEditPrivate::ensureCursorVisible(), QScrollArea::ensureWidgetVisible(), QPlainTextEdit::event(), QTextEdit::event(), QSystemTrayIconSys::findTrayGeometry(), QWidgetPrivate::frameStrut(), QBspTree::init(), QMenu::keyPressEvent(), QAbstractItemView::keyPressEvent(), QTest::mouseEvent(), QScrollBar::mousePressEvent(), QSlider::mousePressEvent(), QAbstractButtonPrivate::moveFocus(), QAccessibleWidget::navigate(), QAbstractItemViewPrivate::position(), QListModeViewBase::position(), qt_cleanlooks_draw_buttongradient(), qt_cleanlooks_draw_gradient(), qt_cleanlooks_draw_mdibutton(), qt_keyrelease_scanner(), qt_plastique_draw_gradient(), QtWndProc(), QAccessibleWidget::relationTo(), QBBScreen::resizeTopLevelWindow(), QAbstractItemView::setCurrentIndex(), QWidgetPrivate::setGeometry_sys(), QListView::setSelection(), QComboBox::showPopup(), QStyleSheetStyle::subControlRect(), QCommonStyle::subElementRect(), QMacStyle::subElementRect(), QCommonStylePrivate::tabLayout(), QPlainTextEdit::timerEvent(), QTextEdit::timerEvent(), QStyleSheetStyle::titleBarLayout(), and QGraphicsViewPrivate::updateLastCenterPoint().

301 { return QPoint((x1+x2)/2, (y1+y2)/2); }
int y1
Definition: qrect.h:177
int y2
Definition: qrect.h:179
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
int x2
Definition: qrect.h:180
int x1
Definition: qrect.h:178

◆ contains() [1/4]

bool QRect::contains ( const QPoint point,
bool  proper = false 
) const

Returns true if the given point is inside or on the edge of the rectangle, otherwise returns false.

If proper is true, this function only returns true if the given point is inside the rectangle (i.e., not on the edge).

See also
intersects()

Definition at line 1101 of file qrect.cpp.

Referenced by _q_paintIntoCache(), QMenuPrivate::actionAt(), QRectF::bottomLeft(), QAccessibleWidget::childAt(), QAccessibleAbstractScrollArea::childAt(), QAccessibleApplication::childAt(), QAccessibleItemRow::childAt(), QAccessibleStackedWidget::childAt(), QAccessibleMdiSubWindow::childAt(), QAccessibleComboBox::childAt(), QAccessibleMainWindow::childAt(), contains(), QMacStylePrivate::contentFitsInPushButton(), QDialog::contextMenuEvent(), QVGPixmapData::copy(), do_size_hints(), dockPosHelper(), QIconModeViewBase::doDynamicLayout(), QOleDropTarget::DragOver(), QRasterPaintEngine::drawImage(), QGraphicsScenePrivate::drawItemHelper(), QAbstractItemViewPrivate::dropOn(), QStyledItemDelegate::editorEvent(), QItemDelegate::editorEvent(), QTabBar::event(), QWidgetResizeHandler::eventFilter(), QTipLabel::eventFilter(), QCalendarWidget::eventFilter(), QComboBoxPrivateContainer::eventFilter(), QTreeViewPrivate::expandOrCollapseItemAtPos(), find_child(), QMdi::MinOverlapPlacer::findNonInsiders(), findRealWindow(), QDockAreaLayoutInfo::findSeparator(), QDockAreaLayout::findSeparator(), flipPoint(), QToolBarAreaLayoutInfo::gapIndex(), QDockAreaLayout::gapIndex(), QApplicationPrivate::globalEventProcessor(), QRadioButton::hitButton(), QPushButtonPrivate::hitButton(), QCheckBox::hitButton(), QAbstractButton::hitButton(), QCommonStyle::hitTestComplexControl(), QPlastiqueStyle::hitTestComplexControl(), QStyleSheetStyle::hitTestComplexControl(), QListView::indexAt(), QGraphicsSceneIndexPathIntersector::intersect(), QDockWidgetPrivate::mouseDoubleClickEvent(), QScrollBar::mouseMoveEvent(), QWidgetResizeHandler::mouseMoveEvent(), QTipLabel::mouseMoveEvent(), QMenu::mouseMoveEvent(), QPlainTextEdit::mouseMoveEvent(), QWorkspaceTitleBar::mouseMoveEvent(), QTextEdit::mouseMoveEvent(), QToolButton::mousePressEvent(), QDockWidgetPrivate::mousePressEvent(), QVistaHelper::mousePressEvent(), QWhatsThat::mousePressEvent(), QMenu::mousePressEvent(), QCalendarPopup::mousePressEvent(), QWorkspaceTitleBar::mousePressEvent(), QWhatsThat::mouseReleaseEvent(), QWorkspaceTitleBar::mouseReleaseEvent(), QSliderPrivate::newHoverControl(), QDockWidgetPrivate::nonClientAreaMouseEvent(), QDockAreaLayoutInfo::paintSeparators(), QDockAreaLayout::paintSeparators(), parseGeometry(), PointInRegion(), QAbstractItemViewPrivate::position(), QListModeViewBase::position(), qt_grab_cursor(), qt_mac_mouse_inside_answer_rect(), qt_mac_update_widget_position(), qt_try_modal(), QtWndProc(), QTreeViewPrivate::renderTreeToPixmapForAnimation(), QBBScreen::resizeTopLevelWindow(), QTreeView::scrollTo(), QVistaHelper::setMouseCursor(), QAccessibleMdiSubWindow::state(), QTabBar::tabAt(), QTipLabel::tipChanged(), QPixmapData::toImage(), QX11PixmapData::toImage(), QPlatformScreen::topLevelAt(), QFbScreen::topLevelAt(), QApplication::topLevelAt(), QScriptEdit::updateExtraArea(), QMenuBarPrivate::updateGeometries(), QGraphicsWidgetPrivate::windowFrameHoverMoveEvent(), windowInteractsWithPosition(), and QApplication::x11ProcessEvent().

1102 {
1103  int l, r;
1104  if (x2 < x1 - 1) {
1105  l = x2;
1106  r = x1;
1107  } else {
1108  l = x1;
1109  r = x2;
1110  }
1111  if (proper) {
1112  if (p.x() <= l || p.x() >= r)
1113  return false;
1114  } else {
1115  if (p.x() < l || p.x() > r)
1116  return false;
1117  }
1118  int t, b;
1119  if (y2 < y1 - 1) {
1120  t = y2;
1121  b = y1;
1122  } else {
1123  t = y1;
1124  b = y2;
1125  }
1126  if (proper) {
1127  if (p.y() <= t || p.y() >= b)
1128  return false;
1129  } else {
1130  if (p.y() < t || p.y() > b)
1131  return false;
1132  }
1133  return true;
1134 }
int y1
Definition: qrect.h:177
int y2
Definition: qrect.h:179
QFactoryLoader * l
int x2
Definition: qrect.h:180
int x1
Definition: qrect.h:178

◆ contains() [2/4]

bool QRect::contains ( int  x,
int  y 
) const
inline

Returns true if the point (x, y) is inside this rectangle, otherwise returns false.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 459 of file qrect.h.

460 {
461  return contains(QPoint(ax, ay), false);
462 }
bool contains(const QPoint &p, bool proper=false) const
Returns true if the given point is inside or on the edge of the rectangle, otherwise returns false...
Definition: qrect.cpp:1101
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53

◆ contains() [3/4]

bool QRect::contains ( int  x,
int  y,
bool  proper 
) const
inline

Returns true if the point (x, y) is inside or on the edge of the rectangle, otherwise returns false.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

If proper is true, this function only returns true if the point is entirely inside the rectangle(not on the edge).

Definition at line 454 of file qrect.h.

455 {
456  return contains(QPoint(ax, ay), aproper);
457 }
bool contains(const QPoint &p, bool proper=false) const
Returns true if the given point is inside or on the edge of the rectangle, otherwise returns false...
Definition: qrect.cpp:1101
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53

◆ contains() [4/4]

bool QRect::contains ( const QRect rectangle,
bool  proper = false 
) const

Returns true if the given rectangle is inside this rectangle.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

otherwise returns false. If proper is true, this function only returns true if the rectangle is entirely inside this rectangle (not on the edge).

Definition at line 1174 of file qrect.cpp.

1175 {
1176  if (isNull() || r.isNull())
1177  return false;
1178 
1179  int l1 = x1;
1180  int r1 = x1;
1181  if (x2 - x1 + 1 < 0)
1182  l1 = x2;
1183  else
1184  r1 = x2;
1185 
1186  int l2 = r.x1;
1187  int r2 = r.x1;
1188  if (r.x2 - r.x1 + 1 < 0)
1189  l2 = r.x2;
1190  else
1191  r2 = r.x2;
1192 
1193  if (proper) {
1194  if (l2 <= l1 || r2 >= r1)
1195  return false;
1196  } else {
1197  if (l2 < l1 || r2 > r1)
1198  return false;
1199  }
1200 
1201  int t1 = y1;
1202  int b1 = y1;
1203  if (y2 - y1 + 1 < 0)
1204  t1 = y2;
1205  else
1206  b1 = y2;
1207 
1208  int t2 = r.y1;
1209  int b2 = r.y1;
1210  if (r.y2 - r.y1 + 1 < 0)
1211  t2 = r.y2;
1212  else
1213  b2 = r.y2;
1214 
1215  if (proper) {
1216  if (t2 <= t1 || b2 >= b1)
1217  return false;
1218  } else {
1219  if (t2 < t1 || b2 > b1)
1220  return false;
1221  }
1222 
1223  return true;
1224 }
bool isNull() const
Returns true if the rectangle is a null rectangle, otherwise returns false.
Definition: qrect.h:231
int y1
Definition: qrect.h:177
int y2
Definition: qrect.h:179
int x2
Definition: qrect.h:180
int x1
Definition: qrect.h:178

◆ getCoords()

void QRect::getCoords ( int *  x1,
int *  y1,
int *  x2,
int *  y2 
) const
inline

Extracts the position of the rectangle's top-left corner to *x1 and *y1, and the position of the bottom-right corner to *x2 and *y2.

See also
setCoords(), getRect()

Definition at line 408 of file qrect.h.

Referenced by QRectF::bottomLeft(), QVistaHelper::collapseTopFrameStrut(), and QMotifStyle::drawControl().

409 {
410  *xp1 = x1;
411  *yp1 = y1;
412  *xp2 = x2;
413  *yp2 = y2;
414 }
int y1
Definition: qrect.h:177
int y2
Definition: qrect.h:179
int x2
Definition: qrect.h:180
int x1
Definition: qrect.h:178

◆ getRect()

void QRect::getRect ( int *  x,
int *  y,
int *  width,
int *  height 
) const
inline

Extracts the position of the rectangle's top-left corner to *x and *y, and its dimensions to *width and *height.

See also
setRect(), getCoords()

Definition at line 392 of file qrect.h.

Referenced by QDirectFbBlitter::alphaFillRect(), QRectF::bottomLeft(), QCommonStyle::drawControl(), QPlastiqueStyle::drawControl(), QCleanlooksStyle::drawControl(), QWindowsXPStyle::drawControl(), QGtkStyle::drawControl(), QMotifStyle::drawControl(), QStyle::itemPixmapRect(), and QStyle::itemTextRect().

393 {
394  *ax = x1;
395  *ay = y1;
396  *aw = x2 - x1 + 1;
397  *ah = y2 - y1 + 1;
398 }
int y1
Definition: qrect.h:177
int y2
Definition: qrect.h:179
int x2
Definition: qrect.h:180
int x1
Definition: qrect.h:178

◆ height()

int QRect::height ( ) const
inline

Returns the height of the rectangle.

See also
setHeight(), width(), size()

Definition at line 306 of file qrect.h.

Referenced by _q_adjustRect(), QPlainTextEditPrivate::_q_adjustScrollbars(), QTextEditPrivate::_q_ensureVisible(), QLabelPrivate::_q_movieUpdated(), QWindowsAccessible::accLocation(), QMdi::MinOverlapPlacer::accumulatedOverlap(), QPushButtonPrivate::adjustedMenuPosition(), QWidgetPrivate::adjustedSize(), QDialog::adjustPosition(), QLayout::alignmentRect(), QDockAreaLayoutInfo::apply(), QWorkspace::arrangeIcons(), QBBScreen::availableGeometry(), QBalloonTip::balloon(), QPicturePaintEngine::begin(), QPainter::begin(), QTreeViewPrivate::beginAnimatedOperation(), blendCursor(), QAhiScreen::blit(), QDirectFBPaintEnginePrivate::blit(), blit180(), blit270(), blit90(), blit_template(), QGLFramebufferObject::blitFramebuffer(), QVGCompositionHelper::blitWindow(), QRectF::bottomLeft(), QDeclarativeText::boundingRect(), QGraphicsItem::boundingRegion(), calcArrow(), QPrintPreviewWidgetPrivate::calcCurrentPage(), QStyleHelper::calcLines(), QStyleHelper::calcRadialPos(), QRegionPrivate::canAppend(), QRegionPrivate::canPrepend(), QComboBox::changeEvent(), QDesktopWidgetPrivate::cleanup(), QVGPaintEngine::clearRect(), QPaintEngineEx::clip(), clipLine(), QColorPicker::colPt(), QScreen::compose(), QMultiScreen::connect(), constrainedRect(), QRegion::contains(), QWidget::contentsRect(), QMacPixmapData::copy(), QDirectFBPixmapData::copy(), QX11PixmapData::copy(), QVGPixmapData::copy(), QGLPixmapData::copy(), QImage::copy(), QBBWindow::copyBack(), QVolatileImage::copyFrom(), QWidgetPrivate::create_sys(), QOleDropSource::createCursors(), QDirectFBScreen::createDFBSurface(), QDirectFBScreen::createSurface(), QDirectFBWindowSurface::createWindow(), QWaylandWindow::damage(), QStyleSheetStyle::defaultSize(), QDeclarativePaintedItem::dirtyCache(), QGridLayoutPrivate::distribute(), do_size_hints(), dockPosHelper(), QETWidget::doDeferredMap(), QItemDelegate::doLayout(), QXlibWindow::doSizeHints(), QListModeViewBase::doStaticLayout(), QListModeViewBase::dragMoveEvent(), QVGPixmapConvolutionFilter::draw(), QVGPixmapColorizeFilter::draw(), QVGPixmapDropShadowFilter::draw(), QVGPixmapBlurFilter::draw(), QRenderRule::drawBackgroundImage(), QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(), QVistaHelper::drawBlackRect(), QStyleHelper::drawBorderPixmap(), QTreeView::drawBranches(), QWindowsVistaStyle::drawComplexControl(), QWindowsCEStyle::drawComplexControl(), QCommonStyle::drawComplexControl(), QPlastiqueStyle::drawComplexControl(), QWindowsMobileStyle::drawComplexControl(), QCleanlooksStyle::drawComplexControl(), QWindowsStyle::drawComplexControl(), QWindowsXPStyle::drawComplexControl(), QGtkStyle::drawComplexControl(), QMotifStyle::drawComplexControl(), QStyleSheetStyle::drawComplexControl(), QMacStyle::drawComplexControl(), QWindowsCEStyle::drawControl(), QWindowsVistaStyle::drawControl(), QCommonStyle::drawControl(), QPlastiqueStyle::drawControl(), QWindowsMobileStyle::drawControl(), QCleanlooksStyle::drawControl(), QWindowsXPStyle::drawControl(), QWindowsStyle::drawControl(), QGtkStyle::drawControl(), QMotifStyle::drawControl(), QMacStyle::drawControl(), QStyleSheetStyle::drawControl(), QStyleHelper::drawDial(), QItemDelegate::drawDisplay(), QX11PaintEngine::drawEllipse(), QPainter::drawEllipse(), drawEllipse_midpoint_i(), drawEllipsePoints(), QX11PaintEngine::drawFreetype(), QRasterPaintEngine::drawImage(), QRasterPaintEnginePrivate::drawImage(), drawImageTiled(), QGraphicsScenePrivate::drawItemHelper(), QGLTrapezoidMaskGenerator::drawMask(), QWindowsMobileStylePrivate::drawPanelItemViewSelected(), QVGPaintEngine::drawPixmapFragments(), QDirectFbBlitter::drawPixmapOpacity(), QWindowsCEStyle::drawPrimitive(), QWindowsVistaStyle::drawPrimitive(), QCommonStyle::drawPrimitive(), QWindowsMobileStyle::drawPrimitive(), QPlastiqueStyle::drawPrimitive(), QCleanlooksStyle::drawPrimitive(), QCDEStyle::drawPrimitive(), QWindowsXPStyle::drawPrimitive(), QWindowsStyle::drawPrimitive(), QGtkStyle::drawPrimitive(), QMotifStyle::drawPrimitive(), QX11PaintEngine::drawRects(), QVGPaintEngine::drawRects(), QOpenGLPaintEngine::drawRects(), QPaintEngine::drawRects(), QPaintEngineEx::drawRects(), QPainter::drawRects(), drawRects(), QTreeView::drawRow(), QWindowsMobileStylePrivate::drawScrollbarGrip(), drawTabBase(), QPainter::drawText(), QDirectFBPaintEnginePrivate::drawTiledPixmap(), QVistaHelper::drawTitleBar(), QVistaHelper::drawTitleText(), QTreeView::drawTree(), drawVGImage(), QWindowsCEStylePrivate::drawWinCEButton(), QWindowsCEStylePrivate::drawWinCEPanel(), effectiveState(), QPSPrintEnginePrivate::emitHeader(), QPicturePaintEngine::end(), QOutlineMapper::endOutline(), QScrollArea::ensureWidgetVisible(), QMdiSubWindowPrivate::enterRubberBandMode(), QScriptEdit::extraAreaPaintEvent(), QVGCompositionHelper::fillBackground(), fillBackgroundRect(), QBlitterPaintEngine::fillRect(), QDirectFBPaintEngine::fillRect(), fillRect_normalized(), fillRects(), QVGPaintEngine::fillRegion(), QOpenGLPaintEnginePrivate::fillVertexArray(), QMdi::MinOverlapPlacer::findMaxOverlappers(), QSystemTrayIconSys::findTrayGeometry(), QToolBarAreaLayout::fitLayout(), QDockAreaLayout::fitLayout(), QWindowsXPStylePrivate::fixAlphaChannel(), QListViewPrivate::flipX(), flipYCoordinate(), QCocoaWindowSurface::flush(), QX11GLWindowSurface::flush(), QWaylandShmWindowSurface::flush(), QMacWindowSurface::flush(), QX11WindowSurface::flush(), QGLWindowSurface::flush(), QRasterWindowSurface::flush(), flushRow(), QDockAreaLayout::gapIndex(), get_combo_parameters(), QDockAreaLayout::getGrid(), getNetWmState(), QX11GLWindowSurface::grabWidget(), QX11WindowSurface::grabWidget(), QWindowSurface::grabWidget(), QPixmap::grabWidget(), QVNCIntegration::grabWindow(), QXcbWindow::handleConfigureNotifyEvent(), QWindowsXPStylePrivate::hasAlphaChannel(), QWindowsXPStylePrivate::hasAnyData(), QPdfEnginePrivate::height(), QDesktopWidgetPrivate::init(), QDockWidgetPrivate::initDrag(), QMacStylePrivate::initHIThemePushButton(), QClipData::initialize(), QSpanData::initTexture(), QWorkspacePrivate::insertIcon(), QVGPaintEngine::isDefaultClipRect(), QVGPaintEngine::isDefaultClipRegion(), isEmptyHelper(), QRasterPaintEnginePrivate::isUnclipped(), Q3AccessibleTextEdit::itemRect(), QStyle::itemTextRect(), QMdiSubWindow::keyPressEvent(), QTabBarPrivate::layoutTabs(), QCoreGraphicsPaintEngine::macDisplayColorSpace(), make_widget_eventUPP(), make_win_eventUPP(), QMatrix::map(), QMatrix::mapRect(), QTransform::mapRect(), QMatrix4x4::mapRect(), QMatrix::mapToPolygon(), QTransform::mapToPolygon(), QListModeViewBase::mapToViewport(), QtopiaPrintEngine::metric(), QPicture::metric(), QPdfBaseEngine::metric(), QCustomRasterPaintDevice::metric(), QWidget::metric(), QVGPaintEnginePrivate::modifyMask(), QVistaHelper::mouseMoveEvent(), QTabBar::mouseMoveEvent(), QSizeGrip::mousePressEvent(), QScrollBar::mousePressEvent(), QmlJSDebugger::ZoomTool::mouseReleaseEvent(), QTabBar::mouseReleaseEvent(), PvrEglWindowSurface::move(), QListView::moveCursor(), QAccessibleWidget::navigate(), QMacPrintEnginePrivate::newPage_helper(), operator<<(), QMatrix4x4::ortho(), packRect(), QtopiaPrintEngine::pageRect(), QPdfBaseEnginePrivate::pageRect(), QDecorationWindows::paint(), QDecorationDefault::paint(), QDeclarativePaintedItem::paint(), QFontFamilyDelegate::paint(), QColumnViewDelegate::paint(), QScriptDebuggerLocalsItemDelegate::paint(), QGtkPainter::paintArrow(), QScreen::paintBackground(), QGtkPainter::paintBox(), QGtkPainter::paintBoxGap(), QDecorationWindows::paintButton(), QGtkPainter::paintCheckbox(), QLabel::paintEvent(), QWellArray::paintEvent(), QPagePreview::paintEvent(), QSystemTrayIconSys::paintEvent(), QWhatsThat::paintEvent(), QListView::paintEvent(), QLineEdit::paintEvent(), QPlainTextEdit::paintEvent(), QColorLuminancePicker::paintEvent(), QGtkPainter::paintExpander(), QGtkPainter::paintExtention(), QGtkPainter::paintFlatBox(), QGtkPainter::paintFocus(), QGtkPainter::paintHandle(), QGtkPainter::paintOption(), QGtkPainter::paintResizeGrip(), QGtkPainter::paintShadow(), QGtkPainter::paintSlider(), QPdfBaseEnginePrivate::paperRect(), QPlatformScreen::physicalSize(), QMotifStyle::pixelMetric(), QSliderPrivate::pixelPosToRangeValue(), QScrollBarPrivate::pixelPosToRangeValue(), QTipLabel::placeTip(), QWidgetPrivate::pointToRect(), PolygonRegion(), QMenu::popup(), QToolButtonPrivate::popupTimerDone(), QStyleSheetStyle::positionRect(), QDeclarativeTextInput::positionToRectangle(), QBBWindow::post(), QTreeViewPrivate::prepareAnimatedOperation(), QRasterWindowSurface::prepareBuffer(), QGraphicsScenePrivate::processDirtyItemsRecursive(), QGLPixmapBlurFilter::processGL(), QGLPixmapDropShadowFilter::processGL(), QMacStylePrivate::pushButtonSizeFromContents(), QXcbShmImage::put(), QBBRootWindow::QBBRootWindow(), QCocoaScreen::QCocoaScreen(), QCocoaWindow::QCocoaWindow(), QCocoaWindowSurface::QCocoaWindowSurface(), qDrawBorderPixmap(), qDrawPlainRect(), qDrawShadePanel(), qDrawShadeRect(), qDrawWinButton(), qDrawWinPanel(), QLinuxFbScreen::QLinuxFbScreen(), qNormalizeRadii(), QPolygon::QPolygon(), QRectF::QRectF(), QRegion::QRegion(), QRegionPrivate::QRegionPrivate(), qstring_to_xtp(), QSvgImage::QSvgImage(), qt_add_rect(), qt_bitmapToRegion(), qt_cleanlooks_draw_buttongradient(), qt_grab_cursor(), qt_hirectForQRect(), qt_mac_clip_cg(), qt_mac_grabDisplayRect(), qt_mac_grabScreenRect(), qt_mac_post_retranslateAppMenu(), qt_mac_unregister_widget(), qt_mac_update_widget_position(), qt_plastique_draw_gradient(), qt_plastique_draw_handle(), qt_region_strictContains(), qt_regionToPath(), qt_scale_image_16bit(), qt_scale_image_32bit(), qt_tablet_cleanup_wce(), qt_transform_image_rasterize(), qt_wince_full_screen(), qt_x11_drawImage(), QtWndProc(), QGLMaskTextureCache::quadtreeInsert(), QVNCDirtyMap::QVNCDirtyMap(), QWhatsThat::QWhatsThat(), read_jpeg_image(), QMdi::RegularTiler::rearrange(), QMdi::SimpleCascader::rearrange(), QMdi::IconTiler::rearrange(), QAccessibleMenu::rect(), QAccessibleAbstractSpinBox::rect(), QAccessibleMenuBar::rect(), QAccessibleDoubleSpinBox::rect(), QAccessibleScrollBar::rect(), QAccessibleSlider::rect(), QAccessibleDial::rect(), QAccessibleTabBar::rect(), QAccessibleMdiSubWindow::rect(), QAccessibleComboBox::rect(), QDecorationStyled::region(), QDecorationDefault::region(), QGraphicsView::render(), QWidgetPrivate::render_helper(), QGtkPainter::renderTheme(), QFbWindow::repaint(), QWidget::repaint(), QProgressBarPrivate::repaintRequired(), QScriptEdit::resizeEvent(), QXlibWindow::resizeEvent(), QWorkspaceChild::resizeEvent(), QBBScreen::resizeNativeWidgetWindow(), QMdiAreaPrivate::resizeToMinimumTileSize(), QBBScreen::resizeTopLevelWindow(), QWidget::restoreGeometry(), rotateTabPainter(), QAlphaWidget::run(), QColorPicker::satPt(), QDockAreaLayoutInfo::saveState(), QWhatsThisPrivate::say(), QmlJSDebugger::ZoomTool::scaleView(), QDesktopWidget::screenNumber(), QX11GLWindowSurface::scroll(), QMacWindowSurface::scroll(), QX11WindowSurface::scroll(), QX11PixmapData::scroll(), QDirectFBWindowSurface::scroll(), QDirectFBPixmapData::scroll(), QGLWindowSurface::scroll(), QRasterWindowSurface::scroll(), QVGEGLWindowSurfaceDirect::scroll(), QWidgetPrivate::scroll_sys(), QMenuPrivate::scrollMenu(), scrollSurface(), QTreeView::scrollTo(), QDockAreaLayout::separatorRect(), QPolygonClipper< qt_float_point, qt_float_point, float >::setBoundingRect(), QClipData::setClipRect(), QPainter::setClipRegion(), QClipData::setClipRegion(), QUnixPrintWidgetPrivate::setCupsProperties(), PvrEglWindowSurface::setDirectRegion(), QIntfbScreen::setDirty(), QQnxScreen::setDirty(), QLinuxFbScreen::setDirty(), QWidget::setDisabled(), QMenuPrivate::setFirstActionActive(), QLinuxFbScreen::setFormat(), QSplitterPrivate::setGeo(), QLinuxFbScreen::setGeometry(), QCocoaWindow::setGeometry(), QWaylandEglWindow::setGeometry(), QDirectFbWindow::setGeometry(), PvrEglWindowSurface::setGeometry(), QXcbWindow::setGeometry(), QOpenKODEWindow::setGeometry(), QBBWindow::setGeometry(), QX11GLWindowSurface::setGeometry(), QDirectFBWindowSurface::setGeometry(), QXlibWindow::setGeometry(), QRasterWindowSurface::setGeometry(), QBoxLayout::setGeometry(), QWidgetItem::setGeometry(), QFormLayout::setGeometry(), QDockWidgetLayout::setGeometry(), QWidget::setGeometry(), QWidgetPrivate::setGeometry_sys(), QAbstractItemViewPrivate::setHoverIndex(), QMdiSubWindowPrivate::setMaximizeMode(), QWidgetPrivate::setMinimumSize_helper(), QMdiSubWindowPrivate::setNewGeometry(), QDeclarativePaintedItem::setPixelCacheSize(), QBBScreen::setRotation(), QSplitter::setRubberBand(), QGL2PaintEngineExPrivate::setScissor(), QListView::setSelection(), QPageSetupWidget::setupPrinter(), QPainter::setViewport(), QPainter::setWindow(), setWindowGeometry(), QWidget::setWindowState(), QDeclarativeRectValueType::setY(), QCompleterPrivate::showPopup(), QComboBox::showPopup(), size(), QLabelPrivate::sizeForWidth(), QMenuBar::sizeHint(), QMenu::sizeHint(), QAhiScreen::solidFill(), solidFill_template(), QWindowsXPStyle::styleHint(), QMacStyle::styleHint(), QCommonStyle::subControlRect(), QWindowsVistaStyle::subControlRect(), QPlastiqueStyle::subControlRect(), QWindowsXPStyle::subControlRect(), QWindowsMobileStyle::subControlRect(), QWindowsCEStyle::subControlRect(), QCleanlooksStyle::subControlRect(), QMotifStyle::subControlRect(), QMacStyle::subControlRect(), QGtkStyle::subControlRect(), QStyleSheetStyle::subControlRect(), QCommonStyle::subElementRect(), QWindowsVistaStyle::subElementRect(), QWindowsCEStyle::subElementRect(), QMacStyle::subElementRect(), QMotifStyle::subElementRect(), QStyleSheetStyle::subElementRect(), QDirectFBScreen::surfaceForWidget(), QWindowsXPStylePrivate::swapAlphaChannel(), QEglContext::swapBuffersRegion2NOK(), QWidgetBackingStore::sync(), QWindowsXPStylePrivate::tabBody(), QCommonStylePrivate::tabLayout(), QWidget::testAttribute(), QPlainTextEdit::timerEvent(), QTextEdit::timerEvent(), QMdiSubWindowPrivate::titleBarHeight(), QStyleSheetStyle::titleBarLayout(), QRasterPixmapData::toImage(), QX11PixmapData::toImage(), XPThemeData::toRECT(), QTest::toString(), toVGImageSubRect(), QX11PixmapData::transformed(), QImage::transformed(), QETWidget::translateTabletEvent(), QApplicationPrivate::translateTouchEvent(), QETWidget::translateXinputEvent(), UnionRectWithRegion(), QWinInputContext::update(), QXIMInputContext::update(), QWidget::update(), QMenuPrivate::updateActionRects(), QPdfBaseEngine::updateClipPath(), QCalendarTextNavigator::updateDateLabel(), QOpenGLPaintEnginePrivate::updateDepthClip(), QScriptEdit::updateExtraArea(), QMenuBarPrivate::updateGeometries(), QTableView::updateGeometries(), QUIKitWindow::updateGeometryAndOrientation(), QDeclarativeTextEdit::updateImgCache(), QRegionPrivate::updateInnerRect(), QGLContext::updatePaintDevice(), QDeclarativeTextInput::updateRect(), updateRedirectedToGraphicsProxyWidget(), QMdiAreaPrivate::updateScrollBars(), QWorkspacePrivate::updateWorkspace(), useScrollBar(), QSettingsPrivate::variantToString(), QCommonListViewBase::verticalScrollToValue(), QListModeViewBase::verticalScrollToValue(), QCommonStylePrivate::viewItemDrawText(), QCommonStylePrivate::viewItemLayout(), and QRfbRawEncoder::write().

307 { return y2 - y1 + 1; }
int y1
Definition: qrect.h:177
int y2
Definition: qrect.h:179

◆ intersect()

QRect QRect::intersect ( const QRect rectangle) const
inline

Use intersected(rectangle) instead.

Definition at line 476 of file qrect.h.

Referenced by QRectF::bottomLeft(), QVGPaintEngine::clip(), intersected(), and QAccessibleTextEdit::rect().

477 {
478  return *this & r;
479 }

◆ intersected()

QRect QRect::intersected ( const QRect rectangle) const
inline

Returns the intersection of this rectangle and the given rectangle.

Since
4.2

Note that r.intersected(s) is equivalent to r & s.

qrect-intersect.png
See also
intersects(), united(), operator&=()

Definition at line 481 of file qrect.h.

Referenced by QMdi::MinOverlapPlacer::accumulatedOverlap(), QRectF::bottomLeft(), QVGPaintEngine::clip(), QGL2PaintEngineEx::clip(), convolute(), QPixmap::copy(), QPixmapBlurFilter::draw(), QPixmapColorizeFilter::draw(), QRenderRule::drawBackgroundImage(), QCommonStyle::drawControl(), QX11PaintEngine::drawEllipse(), QX11PaintEngine::drawFreetype(), QRasterPaintEngine::drawImage(), QStyle::drawItemPixmap(), QRasterPaintEngine::drawPixmap(), QX11PaintEngine::drawRects(), QScriptEdit::extraAreaPaintEvent(), QBlitterPaintEngine::fillRect(), QBlitterPaintEnginePrivate::fillRect(), QOpenGLPaintEnginePrivate::fillVertexArray(), QMdi::MinOverlapPlacer::findMaxOverlappers(), QGLWindowSurface::flush(), QRasterWindowSurface::flush(), handle_xdnd_position(), QRasterPaintEnginePrivate::initializeRasterizer(), QWidgetPrivate::moveRect(), qt_bitmapToRegion(), read_jpeg_image(), QDesktopWidget::screenNumber(), QGLTrapezoidMaskGenerator::screenRect(), QFbScreen::setDirty(), QCommonStyle::subElementRect(), QStyleSheetStyle::subElementRect(), QRasterPixmapData::toImage(), QGL2PaintEngineExPrivate::updateClipScissorTest(), and QItemDelegate::updateEditorGeometry().

482 {
483  return intersect(other);
484 }
QRect intersect(const QRect &r) const
Use intersected(rectangle) instead.
Definition: qrect.h:476

◆ intersects()

bool QRect::intersects ( const QRect rectangle) const
inline

Returns true if this rectangle intersects with the given rectangle (i.

e., there is at least one pixel that is within both rectangles), otherwise returns false.

The intersection rectangle can be retrieved using the intersected() function.

See also
contains()

Definition at line 1429 of file qrect.cpp.

Referenced by QIconModeViewBase::addLeaf(), QRectF::bottomLeft(), QPlatformSoftwareCursor::changeCursor(), QScreen::compose(), QIconModeViewBase::doDynamicLayout(), QListModeViewBase::doStaticLayout(), QAbstractItemViewPrivate::draggablePaintPairs(), QPlatformSoftwareCursor::drawCursor(), QGraphicsScenePrivate::drawItemHelper(), effectiveState(), QAbstractItemViewPrivate::fetchMore(), QPixmap::grabWidget(), QWorkspacePrivate::insertIcon(), QWidgetResizeHandler::mouseMoveEvent(), QAccessibleWidget::navigate(), QStatusBar::paintEvent(), QMenuBar::paintEvent(), QMenu::paintEvent(), QPlatformSoftwareCursor::pointerEvent(), qt_mac_get_widget_rgn(), qt_mac_update_intersected_gl_widgets(), qt_mac_update_widget_position(), QVNCDirtyMap::QVNCDirtyMap(), QAccessibleWidget::relationTo(), QWidget::restoreGeometry(), QGraphicsItem::scroll(), QListView::setSelection(), QAccessibleItemRow::state(), QAccessibleTable2Cell::state(), QGraphicsView::updateScene(), QTableView::visualRegionForSelection(), QListView::visualRegionForSelection(), QTreeView::visualRegionForSelection(), QRfbRawEncoder::write(), and QRfbHextileEncoder< SRC >::write().

1430 {
1431  if (isNull() || r.isNull())
1432  return false;
1433 
1434  int l1 = x1;
1435  int r1 = x1;
1436  if (x2 - x1 + 1 < 0)
1437  l1 = x2;
1438  else
1439  r1 = x2;
1440 
1441  int l2 = r.x1;
1442  int r2 = r.x1;
1443  if (r.x2 - r.x1 + 1 < 0)
1444  l2 = r.x2;
1445  else
1446  r2 = r.x2;
1447 
1448  if (l1 > r2 || l2 > r1)
1449  return false;
1450 
1451  int t1 = y1;
1452  int b1 = y1;
1453  if (y2 - y1 + 1 < 0)
1454  t1 = y2;
1455  else
1456  b1 = y2;
1457 
1458  int t2 = r.y1;
1459  int b2 = r.y1;
1460  if (r.y2 - r.y1 + 1 < 0)
1461  t2 = r.y2;
1462  else
1463  b2 = r.y2;
1464 
1465  if (t1 > b2 || t2 > b1)
1466  return false;
1467 
1468  return true;
1469 }
bool isNull() const
Returns true if the rectangle is a null rectangle, otherwise returns false.
Definition: qrect.h:231
int y1
Definition: qrect.h:177
int y2
Definition: qrect.h:179
int x2
Definition: qrect.h:180
int x1
Definition: qrect.h:178

◆ isEmpty()

bool QRect::isEmpty ( ) const
inline

Returns true if the rectangle is empty, otherwise returns false.

An empty rectangle has a left() > right() or top() > bottom(). An empty rectangle is not valid (i.e., isEmpty() == !isValid()).

Use the normalized() function to retrieve a rectangle where the corners are swapped.

See also
isNull(), isValid(), normalized()

Definition at line 234 of file qrect.h.

Referenced by QWSServerPrivate::_q_newConnection(), QLineEditPrivate::adjustedControlRect(), QSpanData::adjustSpanMethods(), QRegionPrivate::append(), QPainter::begin(), QTreeViewPrivate::beginAnimatedOperation(), QDirectFBPaintEnginePrivate::blit(), QRegionPrivate::canAppend(), QRegionPrivate::canPrepend(), QPixmap::copy(), QBBWindow::copyBack(), QGLMaskTextureCache::createMask(), QWindowsXPStylePrivate::drawBackground(), QWindowsVistaStyle::drawComplexControl(), QWindowsXPStyle::drawComplexControl(), QStyleSheetStyle::drawComplexControl(), QX11PaintEngine::drawEllipse(), QX11PaintEngine::drawFreetype(), QRasterPaintEnginePrivate::drawImage(), QGraphicsScenePrivate::drawItemHelper(), QX11PaintEngine::drawRects(), QDirectFBPaintEnginePrivate::drawTiledPixmap(), QQnxScreen::exposeRegion(), QBlitterPaintEngine::fillRect(), QBlitterPaintEnginePrivate::fillRect(), QOpenGLPaintEnginePrivate::fillVertexArray(), QGLWindowSurface::flush(), QWidgetPrivate::frameStrut(), QX11GLWindowSurface::grabWidget(), QX11WindowSurface::grabWidget(), QWindowSurface::grabWidget(), QWorkspacePrivate::hideChild(), QRegion::intersect(), QRegionPrivate::intersect(), QWidgetPrivate::invalidateBuffer(), QWidgetBackingStore::markDirty(), QListView::moveCursor(), QRegion::operator+=(), QGraphicsProxyWidget::paint(), QMenuBar::paintEvent(), QGraphicsItemEffectSourcePrivate::pixmap(), QRegionPrivate::prepend(), QRect_unite(), QRectF::QRectF(), QRegion::QRegion(), qt_bitmapToRegion(), qt_mac_copy_answer_rect(), qt_mac_mouse_inside_answer_rect(), qt_region_strictContains(), qt_span_fill_clipRect(), QVNCScreenPrivate::QVNCScreenPrivate(), QRasterizer::rasterizeLine(), read_jpeg_image(), QAccessibleTextEdit::rect(), QWidget::repaint(), QPixmap::scroll(), QTreeView::scrollTo(), QVNCScreenPrivate::setDirty(), QBBWindow::setGeometry(), QWSServer::setMaxWindowRect(), QWidgetPrivate::setMinimumSize_helper(), QRegion::setRects(), setWindowGeometry(), QWidgetBackingStore::staticContents(), QCommonStyle::subElementRect(), QWidgetPrivate::subtractOpaqueChildren(), UnionRectWithRegion(), QRegion::unite(), QWidget::update(), QOpenGLPaintEnginePrivate::updateDepthClip(), and QWidget::visibleRegion().

235 { return x1 > x2 || y1 > y2; }
int y1
Definition: qrect.h:177
int y2
Definition: qrect.h:179
int x2
Definition: qrect.h:180
int x1
Definition: qrect.h:178

◆ isNull()

bool QRect::isNull ( ) const
inline

Returns true if the rectangle is a null rectangle, otherwise returns false.

A null rectangle has both the width and the height set to 0 (i.e., right() == left() - 1 and bottom() == top() - 1). A null rectangle is also empty, and hence is not valid.

See also
isEmpty(), isValid()

Definition at line 231 of file qrect.h.

Referenced by QWidgetPrivate::adjustedSize(), QWidgetAnimator::animate(), QDesktopWidget::availableGeometry(), QMenuBarPrivate::calcActionRects(), contains(), QVGPixmapData::copy(), QImage::copy(), QVolatileImage::copyFrom(), QDirectFBScreen::createDFBSurface(), QPlastiqueStyle::drawControl(), QGtkStyle::drawControl(), QPlatformSoftwareCursor::drawCursor(), QRasterPaintEngine::drawImage(), drawImageTiled(), QGraphicsScenePrivate::drawItemHelper(), QDirectFBPaintEnginePrivate::drawTiledPixmap(), QTipLabel::eventFilter(), QDockAreaLayoutInfo::findSeparator(), QDockAreaLayout::findSeparator(), QDockAreaLayoutInfo::gapIndex(), QEglFSScreen::geometry(), QSpanData::initTexture(), QRegion::intersects(), intersects(), QTransformedScreen::mapFromDevice(), QTransformedScreen::mapToDevice(), QTipLabel::mouseMoveEvent(), operator|(), QRectF::operator|(), QPdfBaseEnginePrivate::pageRect(), QPdfBaseEnginePrivate::paperRect(), QRectF::QRectF(), qt_plastique_draw_mdibutton(), QImageReader::read(), QAccessibleItemRow::rect(), QAccessibleTable2Cell::rect(), QAccessibleDockWidget::rect(), QAccessibleTitleBar::rect(), QGraphicsView::render(), QDesktopWidget::screenGeometry(), QMenuPrivate::scrollMenu(), QMenuPrivate::setFirstActionActive(), QDockWidget::setFloating(), QDirectFBWindowSurface::setGeometry(), QDockWidgetLayout::setGeometry(), QTreeView::setSelection(), QStackedLayout::setStackingMode(), QTipLabel::setTipRect(), QDockWidgetPrivate::setWindowState(), QToolBarPrivate::setWindowState(), QMenu::sizeHint(), QDirectFBScreen::surfaceForWidget(), QTipLabel::tipChanged(), QRasterPixmapData::toImage(), QMenuPrivate::updateActionRects(), QColumnView::visualRect(), and QGraphicsWidgetPrivate::windowFrameHoverMoveEvent().

232 { return x2 == x1 - 1 && y2 == y1 - 1; }
int y1
Definition: qrect.h:177
int y2
Definition: qrect.h:179
int x2
Definition: qrect.h:180
int x1
Definition: qrect.h:178

◆ isValid()

bool QRect::isValid ( ) const
inline

Returns true if the rectangle is valid, otherwise returns false.

A valid rectangle has a left() < right() and top() < bottom(). Note that non-trivial operations like intersections are not defined for invalid rectangles. A valid rectangle is not empty (i.e., isValid() == !isEmpty()).

See also
isNull(), isEmpty(), normalized()

Definition at line 237 of file qrect.h.

Referenced by QWindowsAccessible::accLocation(), QWidgetAnimator::animate(), QDockAreaLayoutInfo::apply(), QAccessibleAbstractScrollArea::childAt(), QAccessibleMdiSubWindow::childAt(), constrainedRect(), do_size_hints(), QItemDelegate::doLayout(), QItemDelegate::drawCheck(), QCommonStyle::drawComplexControl(), QWindowsCEStyle::drawComplexControl(), QPlastiqueStyle::drawComplexControl(), QWindowsMobileStyle::drawComplexControl(), QCleanlooksStyle::drawComplexControl(), QWindowsStyle::drawComplexControl(), QGtkStyle::drawComplexControl(), QMotifStyle::drawComplexControl(), QStyleSheetStyle::drawComplexControl(), QCommonStyle::drawControl(), QPlastiqueStyle::drawControl(), QWindowsMobileStyle::drawControl(), QWindowsStyle::drawControl(), QItemDelegate::drawDecoration(), QItemDelegate::drawFocus(), QRasterPaintEnginePrivate::drawImage(), QWindowsMobileStylePrivate::drawPanelItemViewSelected(), QPSPrintEnginePrivate::emitHeader(), QMdiSubWindowPrivate::enterRubberBandMode(), QBlitterPaintEngine::fillRect(), QSystemTrayIconSys::findIconGeometry(), findRealWindow(), flipedRect(), QCommonStyle::hitTestComplexControl(), QStyleSheetStyle::hitTestComplexControl(), QListViewItem::isValid(), QMainWindowLayoutState::isValid(), QDockAreaLayout::isValid(), Q3AccessibleTextEdit::itemRect(), QGraphicsView::mapToScene(), QListViewPrivate::mapToViewport(), QVGPaintEnginePrivate::modifyMask(), QToolButton::mousePressEvent(), QGtkPainter::paintArrow(), QGtkPainter::paintBox(), QGtkPainter::paintBoxGap(), QGtkPainter::paintCheckbox(), QToolBar::paintEvent(), QPagePreview::paintEvent(), QGtkPainter::paintExpander(), QGtkPainter::paintExtention(), QGtkPainter::paintFlatBox(), QGtkPainter::paintFocus(), QGtkPainter::paintHandle(), QGtkPainter::paintHline(), QGtkPainter::paintOption(), QGtkPainter::paintResizeGrip(), QHeaderView::paintSection(), QGtkPainter::paintShadow(), QGtkPainter::paintSlider(), QGtkPainter::paintVline(), QMdi::MinOverlapPlacer::place(), QRectF::QRectF(), qt_grab_cursor(), qt_mac_get_widget_rgn(), qt_mac_update_widget_position(), qt_region_strictContains(), qt_tablet_cleanup_wce(), QSvgIOHandler::read(), QImageReader::read(), QTreeViewPrivate::renderTreeToPixmapForAnimation(), QWidget::restoreGeometry(), QWidgetPrivate::scroll_sys(), QWidgetPrivate::scrollRect(), QDockWidget::setFloating(), QFrame::setFrameRect(), QWidgetPrivate::setLayoutItemMargins(), QCompleterPrivate::showPopup(), QMdiSubWindowPrivate::sizeParameters(), QItemDelegatePrivate::textLayoutBounds(), QAbstractItemView::updateEditorGeometries(), QMenuBarPrivate::updateGeometries(), QCommonStylePrivate::viewItemLayout(), and QCommonStylePrivate::viewItemSize().

238 { return x1 <= x2 && y1 <= y2; }
int y1
Definition: qrect.h:177
int y2
Definition: qrect.h:179
int x2
Definition: qrect.h:180
int x1
Definition: qrect.h:178

◆ left()

int QRect::left ( ) const
inline

Returns the x-coordinate of the rectangle's left edge.

Equivalent to x().

See also
setLeft(), topLeft(), bottomLeft()

Definition at line 240 of file qrect.h.

Referenced by _q_interpolate(), QLabelPrivate::_q_movieUpdated(), QSpanBuffer::addSpan(), QRasterPaintEngine::alphaPenBlt(), QRegionPrivate::append(), QDockAreaLayoutInfo::apply(), QToolBarAreaLayout::apply(), QBalloonTip::balloon(), QPicturePaintEngine::begin(), QAhiScreen::blit(), blit180(), blit270(), blit90(), QGLFramebufferObject::blitFramebuffer(), blitTexture(), QGroupBoxPrivate::calculateFrame(), QRegionPrivate::canAppend(), canMergeFromBelow(), canMergeFromRight(), QRegionPrivate::canPrepend(), QComboBox::changeEvent(), clearRect(), QBspTree::climbTree(), clipStraightLine(), constrainedRect(), QRegion::contains(), QRegionPrivate::contains(), containsViewport(), convolute(), correctNormalized(), QOleDropSource::createCursors(), QToolBarAreaLayoutInfo::distance(), QGridLayoutPrivate::distribute(), QAbstractItemView::doAutoScroll(), QLabelPrivate::documentRect(), QIconModeViewBase::doDynamicLayout(), QItemDelegate::doLayout(), QFbScreen::doRedraw(), QListModeViewBase::doStaticLayout(), QListModeViewBase::dragMoveEvent(), QAbstractItemView::dragMoveEvent(), QVistaHelper::drawBlackRect(), QStyleHelper::drawBorderPixmap(), QTreeView::drawBranches(), QWindowsVistaStyle::drawComplexControl(), QWindowsCEStyle::drawComplexControl(), QPlastiqueStyle::drawComplexControl(), QCleanlooksStyle::drawComplexControl(), QWindowsXPStyle::drawComplexControl(), QGtkStyle::drawComplexControl(), QCommonStyle::drawControl(), QWindowsCEStyle::drawControl(), QWindowsVistaStyle::drawControl(), QPlastiqueStyle::drawControl(), QWindowsMobileStyle::drawControl(), QCleanlooksStyle::drawControl(), QWindowsXPStyle::drawControl(), QWindowsStyle::drawControl(), QGtkStyle::drawControl(), QMotifStyle::drawControl(), QMacStyle::drawControl(), QStyleSheetStyle::drawControl(), QGraphicsScenePrivate::drawItemHelper(), QGLTrapezoidMaskGenerator::drawMask(), QGLEllipseMaskGenerator::drawMask(), QWindowsCEStyle::drawPrimitive(), QCommonStyle::drawPrimitive(), QWindowsVistaStyle::drawPrimitive(), QWindowsMobileStyle::drawPrimitive(), QPlastiqueStyle::drawPrimitive(), QCleanlooksStyle::drawPrimitive(), QWindowsXPStyle::drawPrimitive(), QWindowsStyle::drawPrimitive(), QGtkStyle::drawPrimitive(), QMotifStyle::drawPrimitive(), QMacStyle::drawPrimitive(), QX11PaintEngine::drawRects(), QWindowsMobileStylePrivate::drawScrollbarGrip(), QVistaHelper::drawTitleBar(), QVistaHelper::drawTitleText(), QBoxLayoutPrivate::effectiveMargins(), QGridLayoutPrivate::effectiveMargins(), effectiveState(), QPSPrintEnginePrivate::emitHeader(), QPicturePaintEngine::end(), QPlainTextEditPrivate::ensureCursorVisible(), QScrollArea::ensureWidgetVisible(), QRasterPaintEngine::fillPath(), QOpenGLPaintEnginePrivate::fillVertexArray(), QSystemTrayIconSys::findTrayGeometry(), QToolBarAreaLayoutInfo::fitLayout(), QToolBarAreaLayout::fitLayout(), QDockAreaLayout::fitLayout(), QWindowsXPStylePrivate::fixAlphaChannel(), QGLWindowSurface::flush(), QWidgetPrivate::frameStrut(), QWorkspaceChild::frameWidth(), QDockAreaLayout::gapIndex(), QMdi::MinOverlapPlacer::getCandidatePlacements(), QDockAreaLayout::getGrid(), getNetWmState(), QVNCIntegration::grabWindow(), grayscale(), QWindowsXPStylePrivate::hasAlphaChannel(), QWindowsXPStylePrivate::hasAnyData(), QCommonListViewBase::horizontalScrollToValue(), QListViewPrivate::horizontalScrollToValue(), QListModeViewBase::initStaticLayout(), QRegionPrivate::intersect(), QListModeViewBase::intersectingSet(), intersectsViewport(), isEmptyHelper(), isServerProcess(), QRasterPaintEnginePrivate::isUnclipped(), QRasterPaintEnginePrivate::isUnclipped_normalized(), QToolBarAreaLayoutInfo::itemRect(), QWidgetResizeHandler::keyPressEvent(), QMenu::keyPressEvent(), QAbstractScrollAreaPrivate::layoutChildren(), QTabBarPrivate::layoutTabs(), make_win_eventUPP(), QTabBarPrivate::makeVisible(), QMatrix::mapRect(), QTransform::mapRect(), QMenuBarPrivate::menuRect(), QRegionPrivate::mergeFromLeft(), miCoalesce(), miIntersectO(), miSetExtents(), miSubtractNonO1(), miSubtractO(), miUnionNonO(), miUnionO(), QWidgetResizeHandler::mouseMoveEvent(), QVistaHelper::mouseMoveEvent(), QListView::moveCursor(), QAccessibleWidget::navigate(), QDockWidgetPrivate::nonClientAreaMouseEvent(), operator<<(), QRectF::operator|(), QPdfEnginePrivate::pageMatrix(), QPdfBaseEnginePrivate::pageRect(), QFontFamilyDelegate::paint(), QScriptDebuggerLocalsItemDelegate::paint(), QGtkPainter::paintBox(), QGtkPainter::paintBoxGap(), QVistaBackButton::paintEvent(), QTableView::paintEvent(), QTabBar::paintEvent(), QHeaderView::paintEvent(), QPlainTextEdit::paintEvent(), QWorkspacePrivate::place(), QWidgetPrivate::pointToRect(), PolygonRegion(), QMenu::popup(), QMenuBarPrivate::popupAction(), QToolButtonPrivate::popupTimerDone(), QListModeViewBase::position(), QDateTimeEditPrivate::positionCalendarPopup(), QRegionPrivate::prepend(), QGLPixmapDropShadowFilter::processGL(), PtsToRegion(), qDrawBorderPixmap(), QPolygon::QPolygon(), QRect_unite(), QRectF::QRectF(), qRectIntersects(), qstring_to_xtp(), qt_add_rect(), qt_bitmapToRegion(), qt_cleanlooks_draw_buttongradient(), qt_cleanlooks_draw_gradient(), qt_cleanlooks_draw_mdibutton(), qt_grab_cursor(), qt_intersect_spans(), qt_mac_create_window(), qt_mac_unregister_widget(), qt_plastique_draw_frame(), qt_plastique_draw_handle(), qt_plastique_draw_mdibutton(), qt_plastique_drawFrame(), qt_rect_intersect_normalized(), qt_region_strictContains(), qt_tablet_cleanup_wce(), qt_transform_image_rasterize(), qt_wince_full_screen(), QtWndProc(), QGLMaskTextureCache::quadtreeClear(), QGLMaskTextureCache::quadtreeInsert(), QRasterizer::rasterize(), QRasterizer::rasterizeLine(), rect_intersects(), RectInRegion(), QDecorationWindows::region(), QDecorationDefault::region(), QGraphicsView::render(), QFbWindow::repaint(), QScriptEdit::resizeEvent(), QWidget::restoreGeometry(), QX11PixmapData::scroll(), QListViewPrivate::scrollElasticBandBy(), QDockAreaLayout::separatorRect(), QLinuxFbScreen::setDirty(), QWidget::setDisabled(), QFrame::setFrameRect(), QSplitterPrivate::setGeo(), QBoxLayout::setGeometry(), QWidgetPrivate::setGeometry_sys(), QDockAreaLayout::setGrid(), QWidgetPrivate::setLayoutItemMargins(), QRegion::setRects(), QGL2PaintEngineExPrivate::setScissor(), QTableView::setSelection(), QListView::setSelection(), QTreeView::setSelection(), QWidget::setWindowState(), QAbstractItemViewPrivate::shouldAutoScroll(), QComboBox::showPopup(), showYellowThing_win(), QAhiScreen::solidFill(), QTreeViewPrivate::startAndEndColumns(), QPlastiqueStyle::styleHint(), QCleanlooksStyle::styleHint(), QMacStyle::styleHint(), QPlastiqueStyle::subControlRect(), QCleanlooksStyle::subControlRect(), QMacStyle::subControlRect(), QGtkStyle::subControlRect(), QStyleSheetStyle::subControlRect(), QCommonStyle::subElementRect(), QMacStyle::subElementRect(), QMotifStyle::subElementRect(), QStyleSheetStyle::subElementRect(), QWindowsXPStylePrivate::swapAlphaChannel(), QCommonStylePrivate::tabLayout(), QPlainTextEdit::timerEvent(), QTextEdit::timerEvent(), QStyleSheetStyle::titleBarLayout(), QTest::toString(), QETWidget::translateTabletEvent(), UnionRegion(), QXIMInputContext::update(), QOpenGLPaintEnginePrivate::updateDepthClip(), QMenuBarPrivate::updateGeometries(), QTableView::updateGeometries(), updateRedirectedToGraphicsProxyWidget(), QMdiAreaPrivate::updateScrollBars(), QFramePrivate::updateStyledFrameWidths(), QWorkspacePrivate::updateWorkspace(), useScrollBar(), QCommonStylePrivate::viewItemLayout(), and QRegionPrivate::within().

241 { return x1; }
int x1
Definition: qrect.h:178

◆ moveBottom()

void QRect::moveBottom ( int  y)
inline

Moves the rectangle vertically, leaving the rectangle's bottom edge at the given y coordinate.

The rectangle's size is unchanged.

See also
bottom(), setBottom(), moveTop()

Definition at line 362 of file qrect.h.

Referenced by QToolBarAreaLayout::apply(), QRectF::bottomLeft(), constrainedRect(), moveBottomLeft(), moveBottomRight(), QListView::moveCursor(), QWidget::restoreGeometry(), QListViewPrivate::scrollElasticBandBy(), and QMainWindowLayout::setGeometry().

363 {
364  y1 += (pos - y2);
365  y2 = pos;
366 }
int y1
Definition: qrect.h:177
int y2
Definition: qrect.h:179

◆ moveBottomLeft()

void QRect::moveBottomLeft ( const QPoint position)
inline

Moves the rectangle, leaving the bottom-left corner at the given position.

The rectangle's size is unchanged.

See also
setBottomLeft(), moveBottom(), moveLeft()

Definition at line 386 of file qrect.h.

Referenced by QRectF::bottomLeft(), and QSizeGrip::mouseMoveEvent().

387 {
388  moveLeft(p.x());
389  moveBottom(p.y());
390 }
void moveLeft(int pos)
Moves the rectangle horizontally, leaving the rectangle&#39;s left edge at the given x coordinate...
Definition: qrect.h:350
void moveBottom(int pos)
Moves the rectangle vertically, leaving the rectangle&#39;s bottom edge at the given y coordinate...
Definition: qrect.h:362

◆ moveBottomRight()

void QRect::moveBottomRight ( const QPoint position)
inline

Moves the rectangle, leaving the bottom-right corner at the given position.

The rectangle's size is unchanged.

See also
setBottomRight(), moveRight(), moveBottom()

Definition at line 374 of file qrect.h.

Referenced by QRectF::bottomLeft(), and QSizeGrip::mouseMoveEvent().

375 {
376  moveRight(p.x());
377  moveBottom(p.y());
378 }
void moveRight(int pos)
Moves the rectangle horizontally, leaving the rectangle&#39;s right edge at the given x coordinate...
Definition: qrect.h:356
void moveBottom(int pos)
Moves the rectangle vertically, leaving the rectangle&#39;s bottom edge at the given y coordinate...
Definition: qrect.h:362

◆ moveCenter()

void QRect::moveCenter ( const QPoint position)

Moves the rectangle, leaving the center point at the given position.

The rectangle's size is unchanged.

See also
center()

Definition at line 840 of file qrect.cpp.

Referenced by QRectF::bottomLeft(), QGtkStyle::drawComplexControl(), QWindowsVistaStyle::drawControl(), QPlastiqueStyle::drawControl(), QCleanlooksStyle::drawControl(), QWindowsXPStyle::drawControl(), QGtkStyle::drawControl(), QMotifStyle::drawControl(), QStyleSheetStyle::drawControl(), QCleanlooksStyle::drawPrimitive(), QGtkStyle::drawPrimitive(), QPagePreview::paintEvent(), QBBScreen::resizeTopLevelWindow(), QPlastiqueStyle::subControlRect(), QCleanlooksStyle::subControlRect(), and QStyleSheetStyle::titleBarLayout().

841 {
842  int w = x2 - x1;
843  int h = y2 - y1;
844  x1 = p.x() - w/2;
845  y1 = p.y() - h/2;
846  x2 = x1 + w;
847  y2 = y1 + h;
848 }
int y1
Definition: qrect.h:177
int y2
Definition: qrect.h:179
int x2
Definition: qrect.h:180
int x1
Definition: qrect.h:178

◆ moveLeft()

void QRect::moveLeft ( int  x)
inline

◆ moveRight()

void QRect::moveRight ( int  x)
inline

Moves the rectangle horizontally, leaving the rectangle's right edge at the given x coordinate.

The rectangle's size is unchanged.

See also
right(), setRight(), moveLeft()

Definition at line 356 of file qrect.h.

Referenced by QToolBarAreaLayout::apply(), QRectF::bottomLeft(), constrainedRect(), fixToolBarOrientation(), moveBottomRight(), moveTopRight(), QWidget::restoreGeometry(), QListViewPrivate::scrollElasticBandBy(), and QSplitterPrivate::setGeo().

357 {
358  x1 += (pos - x2);
359  x2 = pos;
360 }
int x2
Definition: qrect.h:180
int x1
Definition: qrect.h:178

◆ moveTo() [1/2]

void QRect::moveTo ( int  x,
int  y 
)
inline

◆ moveTo() [2/2]

void QRect::moveTo ( const QPoint p)
inline

Moves the rectangle, leaving the top-left corner at the given position.

Definition at line 342 of file qrect.h.

343 {
344  x2 += p.x() - x1;
345  y2 += p.y() - y1;
346  x1 = p.x();
347  y1 = p.y();
348 }
int y1
Definition: qrect.h:177
int y2
Definition: qrect.h:179
int y() const
Returns the y coordinate of this point.
Definition: qpoint.h:131
int x2
Definition: qrect.h:180
int x() const
Returns the x coordinate of this point.
Definition: qpoint.h:128
int x1
Definition: qrect.h:178

◆ moveTop()

void QRect::moveTop ( int  y)
inline

◆ moveTopLeft()

void QRect::moveTopLeft ( const QPoint position)
inline

Moves the rectangle, leaving the top-left corner at the given position.

The rectangle's size is unchanged.

See also
setTopLeft(), moveTop(), moveLeft()

Definition at line 368 of file qrect.h.

Referenced by QRectF::bottomLeft(), QDesktopWidgetPrivate::cleanup(), QWidgetPrivate::create_sys(), QDesktopWidgetPrivate::init(), QTabWidget::initStyleOption(), QSizeGrip::mouseMoveEvent(), QWidget::move(), QMainWindowLayout::plug(), QMenu::popup(), QAccessibleToolButton::rect(), QAccessibleDockWidget::rect(), QAccessibleTitleBar::rect(), QDesktopWidget::screenNumber(), QSplitterPrivate::setGeo(), QTabBarPrivate::setupMovableTab(), QCommonStyle::subElementRect(), QETWidget::translateConfigEvent(), QWSInputContext::translateIMQueryEvent(), QDockWidgetPrivate::unplug(), QToolBarPrivate::unplug(), and QDesktopWidgetPrivate::updateScreenList().

369 {
370  moveLeft(p.x());
371  moveTop(p.y());
372 }
void moveLeft(int pos)
Moves the rectangle horizontally, leaving the rectangle&#39;s left edge at the given x coordinate...
Definition: qrect.h:350
void moveTop(int pos)
Moves the rectangle vertically, leaving the rectangle&#39;s top edge at the given y coordinate.
Definition: qrect.h:353

◆ moveTopRight()

void QRect::moveTopRight ( const QPoint position)
inline

Moves the rectangle, leaving the top-right corner at the given position.

The rectangle's size is unchanged.

See also
setTopRight(), moveTop(), moveRight()

Definition at line 380 of file qrect.h.

Referenced by QToolBarAreaLayout::apply(), QRectF::bottomLeft(), and QSizeGrip::mouseMoveEvent().

381 {
382  moveRight(p.x());
383  moveTop(p.y());
384 }
void moveRight(int pos)
Moves the rectangle horizontally, leaving the rectangle&#39;s right edge at the given x coordinate...
Definition: qrect.h:356
void moveTop(int pos)
Moves the rectangle vertically, leaving the rectangle&#39;s top edge at the given y coordinate.
Definition: qrect.h:353

◆ normalized()

QRect QRect::normalized ( ) const

Returns a normalized rectangle; i.e., a rectangle that has a non-negative width and height.

If width() < 0 the function swaps the left and right corners, and it swaps the top and bottom corners if height() < 0.

See also
isValid(), isEmpty()

Definition at line 322 of file qrect.cpp.

Referenced by QPlastiqueStyle::drawControl(), QPainter::drawEllipse(), QRasterPaintEngine::drawRects(), QRasterPaintEngine::drawTiledPixmap(), QRegion::intersect(), QRegionPrivate::intersect(), QListViewPrivate::intersectingSet(), QRegion::intersects(), QRasterPaintEnginePrivate::isUnclipped(), QListView::mouseMoveEvent(), QRectF::QRectF(), QHeaderView::resizeSection(), QTableView::timerEvent(), QTreeView::timerEvent(), and QDirectFBPaintEnginePrivate::updateClip().

323 {
324  QRect r;
325  if (x2 < x1 - 1) { // swap bad x values
326  r.x1 = x2;
327  r.x2 = x1;
328  } else {
329  r.x1 = x1;
330  r.x2 = x2;
331  }
332  if (y2 < y1 - 1) { // swap bad y values
333  r.y1 = y2;
334  r.y2 = y1;
335  } else {
336  r.y1 = y1;
337  r.y2 = y2;
338  }
339  return r;
340 }
int y1
Definition: qrect.h:177
int y2
Definition: qrect.h:179
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
int x2
Definition: qrect.h:180
int x1
Definition: qrect.h:178

◆ operator &()

QRect QRect::operator& ( const QRect r) const

Referenced by QRectF::bottomLeft(), and operator|().

◆ operator &=()

QRect& QRect::operator&= ( const QRect r)

Referenced by QRectF::bottomLeft(), and operator|=().

◆ operator|()

QRect QRect::operator| ( const QRect rectangle) const

Returns the bounding rectangle of this rectangle and the given rectangle.

See also
operator|=(), united()

Definition at line 1261 of file qrect.cpp.

Referenced by QRectF::bottomLeft().

1262 {
1263  if (isNull())
1264  return r;
1265  if (r.isNull())
1266  return *this;
1267 
1268  int l1 = x1;
1269  int r1 = x1;
1270  if (x2 - x1 + 1 < 0)
1271  l1 = x2;
1272  else
1273  r1 = x2;
1274 
1275  int l2 = r.x1;
1276  int r2 = r.x1;
1277  if (r.x2 - r.x1 + 1 < 0)
1278  l2 = r.x2;
1279  else
1280  r2 = r.x2;
1281 
1282  int t1 = y1;
1283  int b1 = y1;
1284  if (y2 - y1 + 1 < 0)
1285  t1 = y2;
1286  else
1287  b1 = y2;
1288 
1289  int t2 = r.y1;
1290  int b2 = r.y1;
1291  if (r.y2 - r.y1 + 1 < 0)
1292  t2 = r.y2;
1293  else
1294  b2 = r.y2;
1295 
1296  QRect tmp;
1297  tmp.x1 = qMin(l1, l2);
1298  tmp.x2 = qMax(r1, r2);
1299  tmp.y1 = qMin(t1, t2);
1300  tmp.y2 = qMax(b1, b2);
1301  return tmp;
1302 }
bool isNull() const
Returns true if the rectangle is a null rectangle, otherwise returns false.
Definition: qrect.h:231
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
int y1
Definition: qrect.h:177
int y2
Definition: qrect.h:179
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
int x2
Definition: qrect.h:180
int x1
Definition: qrect.h:178

◆ operator|=()

QRect & QRect::operator|= ( const QRect rectangle)
inline

Unites this rectangle with the given rectangle.

See also
united(), operator|()

Definition at line 464 of file qrect.h.

Referenced by QRectF::bottomLeft().

465 {
466  *this = *this | r;
467  return *this;
468 }

◆ right()

int QRect::right ( ) const
inline

Returns the x-coordinate of the rectangle's right edge.

Note that for historical reasons this function returns left() + width() - 1; use x() + width() to retrieve the true x-coordinate.

See also
setRight(), topRight(), bottomRight()

Definition at line 246 of file qrect.h.

Referenced by QTextEditPrivate::_q_ensureVisible(), _q_interpolate(), QSpanBuffer::addSpan(), QLineEditPrivate::adjustedContentsRect(), QMenuPrivate::adjustMenuSizeForScreen(), QmlJSDebugger::QDeclarativeViewInspector::adjustToScreenBoundaries(), QRasterPaintEngine::alphaPenBlt(), QWidgetAnimator::animate(), QRegionPrivate::append(), QDockAreaLayoutInfo::apply(), QToolBarAreaLayout::apply(), QBalloonTip::balloon(), blitTexture(), QGroupBoxPrivate::calculateFrame(), canMergeFromBelow(), canMergeFromRight(), QRegionPrivate::canPrepend(), QComboBox::changeEvent(), clearRect(), QBspTree::climbTree(), clipStraightLine(), QListViewPrivate::closestIndex(), constrainedRect(), QRegionPrivate::contains(), containsViewport(), convolute(), correctNormalized(), QToolBarAreaLayoutInfo::distance(), QGridLayoutPrivate::distribute(), QAbstractItemView::doAutoScroll(), QLabelPrivate::documentRect(), QIconModeViewBase::doDynamicLayout(), QItemDelegate::doLayout(), QListModeViewBase::doStaticLayout(), QListModeViewBase::dragMoveEvent(), QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(), QTreeView::drawBranches(), QWindowsCEStyle::drawComplexControl(), QCommonStyle::drawComplexControl(), QPlastiqueStyle::drawComplexControl(), QCleanlooksStyle::drawComplexControl(), QWindowsXPStyle::drawComplexControl(), QGtkStyle::drawComplexControl(), QMotifStyle::drawComplexControl(), QWindowsCEStyle::drawControl(), QWindowsVistaStyle::drawControl(), QCommonStyle::drawControl(), QPlastiqueStyle::drawControl(), QWindowsMobileStyle::drawControl(), QCleanlooksStyle::drawControl(), QWindowsXPStyle::drawControl(), QWindowsStyle::drawControl(), QGtkStyle::drawControl(), QMotifStyle::drawControl(), QMacStyle::drawControl(), QStyleSheetStyle::drawControl(), drawPixel(), drawPixelARGB32(), drawPixelARGB32Opaque(), QWindowsCEStyle::drawPrimitive(), QWindowsVistaStyle::drawPrimitive(), QCommonStyle::drawPrimitive(), QWindowsMobileStyle::drawPrimitive(), QPlastiqueStyle::drawPrimitive(), QCleanlooksStyle::drawPrimitive(), QWindowsXPStyle::drawPrimitive(), QWindowsStyle::drawPrimitive(), QGtkStyle::drawPrimitive(), QMotifStyle::drawPrimitive(), QMacStyle::drawPrimitive(), QWindowsMobileStylePrivate::drawScrollbarGrip(), QDirectFBPaintEnginePrivate::drawTiledPixmap(), drawToolbarButtonArrow(), QBoxLayoutPrivate::effectiveMargins(), QGridLayoutPrivate::effectiveMargins(), effectiveState(), QPSPrintEnginePrivate::emitHeader(), QPlainTextEditPrivate::ensureCursorVisible(), QScrollArea::ensureWidgetVisible(), QQnxScreen::exposeRegion(), QRasterPaintEngine::fillPath(), QToolBarAreaLayoutInfo::fitLayout(), QToolBarAreaLayout::fitLayout(), fixToolBarOrientation(), QDirectFBScreen::flipSurface(), QDirectFbWindowSurface::flush(), flushRow(), QWidgetPrivate::frameStrut(), QDockAreaLayout::gapIndex(), QMdi::MinOverlapPlacer::getCandidatePlacements(), QDockAreaLayout::getGrid(), grayscale(), QCommonListViewBase::horizontalScrollToValue(), QListViewPrivate::horizontalScrollToValue(), QRegionPrivate::intersect(), QListModeViewBase::intersectingSet(), intersectsViewport(), isEmptyHelper(), isServerProcess(), QRasterPaintEnginePrivate::isUnclipped(), QRasterPaintEnginePrivate::isUnclipped_normalized(), QWidgetResizeHandler::keyPressEvent(), QMenu::keyPressEvent(), QAbstractScrollAreaPrivate::layoutChildren(), QTabBarPrivate::layoutTabs(), make_win_eventUPP(), QTabBarPrivate::makeVisible(), QTransformedScreen::mapFromDevice(), QMatrix::mapRect(), QTransform::mapRect(), QTransformedScreen::mapToDevice(), QMenuBarPrivate::menuRect(), QRegionPrivate::mergeFromRight(), miCoalesce(), miIntersectO(), miSetExtents(), miSubtractNonO1(), miSubtractO(), miUnionNonO(), QWidgetResizeHandler::mouseMoveEvent(), QComboBoxPrivateScroller::mouseMoveEvent(), QSizeGrip::mousePressEvent(), QListView::moveCursor(), QAbstractButtonPrivate::moveFocus(), QAccessibleWidget::navigate(), QDockWidgetPrivate::nonClientAreaMouseEvent(), operator<<(), QRectF::operator|(), QDecorationWindows::paint(), QFontFamilyDelegate::paint(), QVistaBackButton::paintEvent(), QTableView::paintEvent(), QTabBar::paintEvent(), QHeaderView::paintEvent(), QLineEdit::paintEvent(), QPlainTextEdit::paintEvent(), path_for_glyphs(), QSliderPrivate::pixelPosToRangeValue(), QScrollBarPrivate::pixelPosToRangeValue(), QWorkspacePrivate::place(), QWidgetPrivate::pointToRect(), PolygonRegion(), QMenu::popup(), QMenuBarPrivate::popupAction(), QToolButtonPrivate::popupTimerDone(), QListModeViewBase::position(), QDateTimeEditPrivate::positionCalendarPopup(), QRegionPrivate::prepend(), PtsToRegion(), qDrawBorderPixmap(), QRect_unite(), qRectIntersects(), qstring_to_xtp(), qt_cleanlooks_draw_buttongradient(), qt_cleanlooks_draw_gradient(), qt_cleanlooks_draw_mdibutton(), qt_grab_cursor(), qt_intersect_spans(), qt_mac_create_window(), qt_mac_unregister_widget(), qt_plastique_draw_frame(), qt_plastique_draw_mdibutton(), qt_plastique_drawFrame(), qt_rect_intersect_normalized(), qt_region_strictContains(), QtWndProc(), QGLMaskTextureCache::quadtreeClear(), QGLMaskTextureCache::quadtreeInsert(), QVNCScreenPrivate::QVNCScreenPrivate(), QRasterizer::rasterize(), QRasterizer::rasterizeLine(), read_jpeg_image(), QMdi::RegularTiler::rearrange(), rect_intersects(), RectInRegion(), QDecorationWindows::region(), QDecorationDefault::region(), QWidget::restoreGeometry(), QListViewPrivate::scrollElasticBandBy(), scrollSurface(), QPageSetupWidget::selectPrinter(), QDockAreaLayout::separatorRect(), QVNCScreenPrivate::setDirty(), QWidget::setDisabled(), QFrame::setFrameRect(), QBoxLayout::setGeometry(), QDockWidgetLayout::setGeometry(), QWidgetPrivate::setGeometry_sys(), QDockAreaLayout::setGrid(), QWidgetPrivate::setLayoutItemMargins(), QRegion::setRects(), QTableView::setSelection(), QListView::setSelection(), QTreeView::setSelection(), QWidget::setWindowState(), QAbstractItemViewPrivate::shouldAutoScroll(), QComboBox::showPopup(), showYellowThing_win(), QWindowsMobileStyle::sizeFromContents(), QWindowsCEStyle::sizeFromContents(), QMenu::sizeHint(), QTreeViewPrivate::startAndEndColumns(), QPlastiqueStyle::styleHint(), QCleanlooksStyle::styleHint(), QMacStyle::styleHint(), QPlastiqueStyle::subControlRect(), QCleanlooksStyle::subControlRect(), QMacStyle::subControlRect(), QStyleSheetStyle::subControlRect(), QCommonStyle::subElementRect(), QMacStyle::subElementRect(), QMotifStyle::subElementRect(), QCommonStylePrivate::tabLayout(), QPlainTextEdit::timerEvent(), QTextEdit::timerEvent(), QStyleSheetStyle::titleBarLayout(), QTest::toString(), UnionRegion(), QXIMInputContext::update(), QDirectFBPaintEnginePrivate::updateClip(), QMenuBarPrivate::updateGeometries(), QTableView::updateGeometries(), QMdiAreaPrivate::updateScrollBars(), QFramePrivate::updateStyledFrameWidths(), QWorkspacePrivate::updateWorkspace(), useScrollBar(), QCommonStylePrivate::viewItemLayout(), QStyle::visualPos(), QStyle::visualRect(), and QRegionPrivate::within().

247 { return x2; }
int x2
Definition: qrect.h:180

◆ setBottom()

void QRect::setBottom ( int  y)
inline

◆ setBottomLeft()

void QRect::setBottomLeft ( const QPoint position)
inline

Set the bottom-left corner of the rectangle to the given position.

May change the size, but will never change the top-right corner of the rectangle.

See also
bottomLeft(), moveBottomLeft()

Definition at line 279 of file qrect.h.

Referenced by QRectF::bottomLeft().

280 { x1 = p.x(); y2 = p.y(); }
int y2
Definition: qrect.h:179
int x1
Definition: qrect.h:178

◆ setBottomRight()

void QRect::setBottomRight ( const QPoint position)
inline

Set the bottom-right corner of the rectangle to the given position.

May change the size, but will never change the top-left corner of the rectangle.

See also
bottomRight(), moveBottomRight()

Definition at line 273 of file qrect.h.

Referenced by QRectF::bottomLeft(), and QAccessibleTextEdit::scrollToSubstring().

274 { x2 = p.x(); y2 = p.y(); }
int y2
Definition: qrect.h:179
int x2
Definition: qrect.h:180

◆ setCoords()

void QRect::setCoords ( int  x1,
int  y1,
int  x2,
int  y2 
)
inline

◆ setHeight()

void QRect::setHeight ( int  height)
inline

Sets the height of the rectangle to the given height.

The bottom edge is changed, but not the top one.

See also
height(), setSize()

Definition at line 445 of file qrect.h.

Referenced by QLabelPrivate::_q_movieUpdated(), QTreeViewPrivate::beginAnimatedOperation(), QRectF::bottomLeft(), QMenuBarPrivate::calcActionRects(), QMacStylePrivate::comboboxEditBounds(), constrainedRect(), QWidgetPrivate::create_sys(), QItemDelegate::doLayout(), QWindowsVistaStyle::drawComplexControl(), QWindowsXPStyle::drawComplexControl(), QMacStyle::drawComplexControl(), QWindowsVistaStyle::drawControl(), QCommonStyle::drawControl(), QGtkStyle::drawControl(), QMacStyle::drawControl(), QCleanlooksStyle::drawPrimitive(), QWindowsStyle::drawPrimitive(), QMotifStyle::drawPrimitive(), drawTabBase(), QPixmap::grabWidget(), QGraphicsWidgetPrivate::initStyleOptionTitleBar(), QRasterPaintEnginePrivate::isUnclipped(), QToolBarAreaLayoutInfo::itemRect(), QStyle::itemTextRect(), QListModeViewBase::mapToViewport(), QGtkPainter::paintBox(), QGtkPainter::paintBoxGap(), QListView::paintEvent(), QGraphicsWidget::paintWindowFrame(), PolygonRegion(), QTreeViewPrivate::prepareAnimatedOperation(), QGLPixmapBlurFilter::processGL(), QGLPixmapDropShadowFilter::processGL(), qDrawPlainRect(), QSvgImage::QSvgImage(), QMdiAreaPrivate::resizeToMinimumTileSize(), QWidget::restoreGeometry(), QWidgetPrivate::scroll_sys(), QMenuPrivate::scrollMenu(), QDockAreaLayout::setGrid(), QDeclarativeRectValueType::setHeight(), QTableView::sizeHintForRow(), QWindowsXPStyle::styleHint(), QCommonStyle::subControlRect(), QPlastiqueStyle::subControlRect(), QWindowsMobileStyle::subControlRect(), QWindowsCEStyle::subControlRect(), QCleanlooksStyle::subControlRect(), QMacStyle::subControlRect(), QGtkStyle::subControlRect(), QCommonStyle::subElementRect(), QWindowsVistaStyle::subElementRect(), QMacStyle::subElementRect(), QCommonStylePrivate::viewItemLayout(), QGraphicsWidgetPrivate::windowFrameHoverMoveEvent(), QGraphicsWidgetPrivate::windowFrameMouseReleaseEvent(), and QApplication::x11ProcessEvent().

446 { y2 = (y1 + h - 1); }
int y1
Definition: qrect.h:177
int y2
Definition: qrect.h:179

◆ setLeft()

void QRect::setLeft ( int  x)
inline

Sets the left edge of the rectangle to the given x coordinate.

May change the width, but will never change the right edge of the rectangle.

Equivalent to setX().

See also
left(), moveLeft()

Definition at line 258 of file qrect.h.

Referenced by QToolBarAreaLayout::apply(), QRectF::bottom(), QLabelPrivate::documentRect(), QWindowsVistaStyle::drawComplexControl(), QWindowsCEStyle::drawComplexControl(), QWindowsXPStyle::drawComplexControl(), QGtkStyle::drawComplexControl(), QCommonStyle::drawControl(), QWindowsMobileStyle::drawControl(), QStyleSheetStyle::drawControl(), QWindowsStyle::drawPrimitive(), QToolBarAreaLayoutInfo::fitLayout(), flushRow(), QDockAreaLayout::getGrid(), handle_xdnd_position(), QBspTree::init(), QRegionPrivate::intersect(), QToolBarAreaLayoutInfo::itemRect(), QListModeViewBase::mapToViewport(), QMenuBarPrivate::menuRect(), QRegionPrivate::mergeFromLeft(), miSetExtents(), QListView::moveCursor(), QDockWidgetPrivate::nonClientAreaMouseEvent(), QFontFamilyDelegate::paint(), QTableView::paintEvent(), PolygonRegion(), PtsToRegion(), qt_grab_cursor(), qt_rect_intersect_normalized(), QtWndProc(), QWhatsThat::QWhatsThat(), QDockWidgetLayout::setGeometry(), QDockAreaLayout::setGrid(), QListView::setSelection(), QRectF::setX(), QPlastiqueStyle::subControlRect(), QStyleSheetStyle::subControlRect(), QMacStyle::subElementRect(), QCommonStylePrivate::tabLayout(), QStyleSheetStyle::titleBarLayout(), and QAlphaPaintEnginePrivate::toRect().

259 { x1 = pos; }
int x1
Definition: qrect.h:178

◆ setRect()

void QRect::setRect ( int  x,
int  y,
int  width,
int  height 
)
inline

Sets the coordinates of the rectangle's top-left corner to ({x}, {y}), and its size to the given width and height.

See also
getRect(), setCoords()

Definition at line 400 of file qrect.h.

Referenced by QLabelPrivate::_q_movieUpdated(), QPushButtonPrivate::adjustedMenuPosition(), QRectF::bottomLeft(), QWellArray::cellGeometry(), QWidgetPrivate::create_sys(), QItemDelegate::doLayout(), QCommonStyle::drawComplexControl(), QPlastiqueStyle::drawComplexControl(), QMacStyle::drawComplexControl(), QCommonStyle::drawControl(), QPlastiqueStyle::drawControl(), QCleanlooksStyle::drawControl(), QWindowsStyle::drawControl(), QGtkStyle::drawControl(), QMotifStyle::drawControl(), QStyleSheetStyle::drawControl(), QWindowsVistaStyle::drawPrimitive(), QTreeView::drawRow(), QWindowsMobileStylePrivate::drawScrollbarGrip(), QTreeView::drawTree(), QPSPrintEnginePrivate::emitHeader(), QTabBarPrivate::initStyleBaseOption(), isServerProcess(), operator>>(), QTreeViewPrivate::paintAlternatingRowColors(), QMenu::paintEvent(), QHeaderView::paintEvent(), QWorkspacePrivate::place(), qt_grab_cursor(), qt_tablet_cleanup_wce(), QAccessibleItemRow::rect(), QHeaderView::resizeSection(), rotateTabPainter(), QSplitterPrivate::setGeo(), QWidgetPrivate::setLayoutItemMargins(), QCommonStyle::subControlRect(), QWindowsVistaStyle::subControlRect(), QPlastiqueStyle::subControlRect(), QWindowsXPStyle::subControlRect(), QWindowsMobileStyle::subControlRect(), QWindowsCEStyle::subControlRect(), QCleanlooksStyle::subControlRect(), QMacStyle::subControlRect(), QGtkStyle::subControlRect(), QCommonStyle::subElementRect(), QWindowsVistaStyle::subElementRect(), QWindowsCEStyle::subElementRect(), QMotifStyle::subElementRect(), QStyleSheetStyle::subElementRect(), QCommonStylePrivate::tabLayout(), and QCommonStylePrivate::viewItemLayout().

401 {
402  x1 = ax;
403  y1 = ay;
404  x2 = (ax + aw - 1);
405  y2 = (ay + ah - 1);
406 }
int y1
Definition: qrect.h:177
int y2
Definition: qrect.h:179
int x2
Definition: qrect.h:180
int x1
Definition: qrect.h:178

◆ setRight()

void QRect::setRight ( int  x)
inline

◆ setSize()

void QRect::setSize ( const QSize size)
inline

Sets the size of the rectangle to the given size.

The top-left corner is not moved.

See also
size(), setWidth(), setHeight()

Definition at line 448 of file qrect.h.

Referenced by QToolBarAreaLayout::apply(), QRectF::bottomLeft(), QWidgetPrivate::create_sys(), QGtkStyle::drawComplexControl(), QStyleSheetStyle::drawComplexControl(), QCommonStyle::drawControl(), QWindowsVistaStyle::drawControl(), QPlastiqueStyle::drawControl(), QWindowsMobileStyle::drawControl(), QCleanlooksStyle::drawControl(), QWindowsXPStyle::drawControl(), QWindowsStyle::drawControl(), QGtkStyle::drawControl(), QMacStyle::drawControl(), QStyleSheetStyle::drawControl(), QCleanlooksStyle::drawPrimitive(), getNetWmState(), isServerProcess(), make_win_eventUPP(), QAbstractSpinBox::minimumSizeHint(), QListView::moveCursor(), QWhatsThat::QWhatsThat(), QWidget::resize(), QBBScreen::resizeTopLevelWindow(), QWidget::restoreGeometry(), QWidget::setGeometry(), QMdiSubWindowPrivate::setNewGeometry(), QMdiSubWindowPrivate::setNormalMode(), QMacStyle::sizeFromContents(), QPushButton::sizeHint(), QToolButton::sizeHint(), QAbstractSpinBox::sizeHint(), QDateTimeEdit::sizeHint(), QCleanlooksStyle::subControlRect(), QGtkStyle::subControlRect(), QCommonStyle::subElementRect(), QMacStyle::subElementRect(), QETWidget::translateConfigEvent(), and QListView::viewOptions().

449 {
450  x2 = (s.width() + x1 - 1);
451  y2 = (s.height() + y1 - 1);
452 }
int y1
Definition: qrect.h:177
int y2
Definition: qrect.h:179
int x2
Definition: qrect.h:180
int x1
Definition: qrect.h:178

◆ setTop()

void QRect::setTop ( int  y)
inline

Sets the top edge of the rectangle to the given y coordinate.

May change the height, but will never change the bottom edge of the rectangle.

Equivalent to setY().

See also
top(), moveTop()

Definition at line 261 of file qrect.h.

Referenced by QToolBarAreaLayout::apply(), QTreeViewPrivate::beginAnimatedOperation(), QRectF::bottom(), QLabelPrivate::documentRect(), QLayoutPrivate::doResize(), QWindowsVistaStyle::drawComplexControl(), QWindowsXPStyle::drawComplexControl(), QGtkStyle::drawComplexControl(), QWindowsCEStyle::drawPrimitive(), QWindowsVistaStyle::drawPrimitive(), QCommonStyle::drawPrimitive(), QWindowsMobileStyle::drawPrimitive(), QWindowsStyle::drawPrimitive(), QToolBarAreaLayoutInfo::fitLayout(), QDockAreaLayout::getGrid(), QBspTree::init(), QToolBarAreaLayoutInfo::itemRect(), QListModeViewBase::mapToViewport(), QRegionPrivate::mergeFromAbove(), miSetExtents(), QVistaHelper::mouseMoveEvent(), QListView::moveCursor(), QDockWidgetPrivate::nonClientAreaMouseEvent(), PolygonRegion(), QTreeViewPrivate::prepareAnimatedOperation(), PtsToRegion(), qt_grab_cursor(), qt_rect_intersect_normalized(), QtWndProc(), QWhatsThat::QWhatsThat(), QMenuPrivate::scrollMenu(), QDockWidgetLayout::setGeometry(), QDockAreaLayout::setGrid(), QListView::setSelection(), QRectF::setY(), QCommonStyle::subControlRect(), QWindowsMobileStyle::subControlRect(), QWindowsCEStyle::subControlRect(), QCleanlooksStyle::subControlRect(), QGtkStyle::subControlRect(), QStyleSheetStyle::subControlRect(), QMacStyle::subElementRect(), QCommonStylePrivate::tabLayout(), QCommandLinkButtonPrivate::titleRect(), QAlphaPaintEnginePrivate::toRect(), and QDeclarativeTextEdit::updateImgCache().

262 { y1 = pos; }
int y1
Definition: qrect.h:177

◆ setTopLeft()

void QRect::setTopLeft ( const QPoint position)
inline

Set the top-left corner of the rectangle to the given position.

May change the size, but will never change the bottom-right corner of the rectangle.

See also
topLeft(), moveTopLeft()

Definition at line 270 of file qrect.h.

Referenced by QRectF::bottomLeft(), QWindowsMobileStylePrivate::drawTabBarTab(), QWidget::setGeometry(), and QMdiSubWindowPrivate::setNewGeometry().

271 { x1 = p.x(); y1 = p.y(); }
int y1
Definition: qrect.h:177
int x1
Definition: qrect.h:178

◆ setTopRight()

void QRect::setTopRight ( const QPoint position)
inline

Set the top-right corner of the rectangle to the given position.

May change the size, but will never change the bottom-left corner of the rectangle.

See also
topRight(), moveTopRight()

Definition at line 276 of file qrect.h.

Referenced by QRectF::bottomLeft().

277 { x2 = p.x(); y1 = p.y(); }
int y1
Definition: qrect.h:177
int x2
Definition: qrect.h:180

◆ setWidth()

void QRect::setWidth ( int  width)
inline

Sets the width of the rectangle to the given width.

The right edge is changed, but not the left one.

See also
width(), setSize()

Definition at line 442 of file qrect.h.

Referenced by QLabelPrivate::_q_movieUpdated(), QRectF::bottomLeft(), QAccessibleTextWidget::characterRect(), constrainedRect(), QWidgetPrivate::create_sys(), QTreeView::currentChanged(), QWindowsVistaStyle::drawComplexControl(), QWindowsXPStyle::drawComplexControl(), QWindowsCEStyle::drawControl(), QWindowsVistaStyle::drawControl(), QCommonStyle::drawControl(), QWindowsMobileStyle::drawControl(), QPlastiqueStyle::drawControl(), QGtkStyle::drawControl(), QMacStyle::drawControl(), QStyleSheetStyle::drawControl(), QCleanlooksStyle::drawPrimitive(), QWindowsStyle::drawPrimitive(), QMotifStyle::drawPrimitive(), drawTabBase(), QPixmap::grabWidget(), QTreeView::indexRowSizeHint(), isEmptyHelper(), QRasterPaintEnginePrivate::isUnclipped(), QToolBarAreaLayoutInfo::itemRect(), QStyle::itemTextRect(), QListModeViewBase::mapToViewport(), QMenuBarPrivate::menuRect(), QComboBoxDelegate::paint(), QListView::paintEvent(), PolygonRegion(), QGLPixmapBlurFilter::processGL(), QGLPixmapDropShadowFilter::processGL(), qDrawPlainRect(), QSvgImage::QSvgImage(), QMdiAreaPrivate::resizeToMinimumTileSize(), QWidgetPrivate::scroll_sys(), QDockAreaLayout::setGrid(), QDeclarativeRectValueType::setWidth(), QTableView::sizeHintForRow(), QPlastiqueStyle::subControlRect(), QCleanlooksStyle::subControlRect(), QMacStyle::subControlRect(), QGtkStyle::subControlRect(), QCommonStyle::subElementRect(), QMacStyle::subElementRect(), QItemDelegatePrivate::textLayoutBounds(), QStyleSheetStyle::titleBarLayout(), QMenuPrivate::updateActionRects(), QComboBoxPrivate::updateLineEditGeometry(), QCommonStylePrivate::viewItemSize(), QTreeView::viewportEvent(), and QApplication::x11ProcessEvent().

443 { x2 = (x1 + w - 1); }
int x2
Definition: qrect.h:180
int x1
Definition: qrect.h:178

◆ setX()

void QRect::setX ( int  x)
inline

◆ setY()

void QRect::setY ( int  y)
inline

Sets the top edge of the rectangle to the given y coordinate.

May change the height, but will never change the bottom edge of the rectangle.

Equivalent to setTop().

See also
y(), setX(), setTopLeft()

Definition at line 285 of file qrect.h.

Referenced by QLineEditPrivate::adjustedContentsRect(), QMacStyle::drawComplexControl(), QMacStyle::drawControl(), QCleanlooksStyle::drawPrimitive(), QMotifStyle::drawPrimitive(), QRasterPaintEnginePrivate::isUnclipped(), QLineEdit::paintEvent(), QtWndProc(), QWidgetPrivate::scroll_sys(), QTableView::sizeHintForRow(), QMacStyle::subControlRect(), and QMacStyle::subElementRect().

286 { y1 = ay; }
int y1
Definition: qrect.h:177

◆ size()

QSize QRect::size ( ) const
inline

Returns the size of the rectangle.

See also
setSize(), width(), height()

Definition at line 309 of file qrect.h.

Referenced by QMoviePrivate::_q_loadNextFrame(), _q_paintIntoCache(), QPageSetupWidget::_q_paperSizeChanged(), QWidgetPrivate::adjustedSize(), QMenuPrivate::adjustMenuSizeForScreen(), QStyle::alignedRect(), QLayout::alignmentRect(), QToolBarAreaLayout::apply(), QtopiaPrintEngine::begin(), QDirectFBPaintEnginePrivate::blit(), QVGCompositionHelper::blitWindow(), QWidgetBackingStore::bltRect(), QRectF::bottomLeft(), QRenderRule::boxSize(), QScreen::compose(), QDirectFBPixmapData::copy(), QGLMaskTextureCache::createMask(), QWidgetBackingStore::dirtyRegion(), do_size_hints(), QIconModeViewBase::doDynamicLayout(), QItemDelegate::doLayout(), QSplitterPrivate::doResize(), QPixmapConvolutionFilter::draw(), QPixmapColorizeFilter::draw(), QWindowsVistaStyle::drawComplexControl(), QPlastiqueStyle::drawComplexControl(), QCleanlooksStyle::drawComplexControl(), QGtkStyle::drawComplexControl(), QStyleSheetStyle::drawComplexControl(), QCommonStyle::drawControl(), QWindowsVistaStyle::drawControl(), QPlastiqueStyle::drawControl(), QWindowsMobileStyle::drawControl(), QCleanlooksStyle::drawControl(), QWindowsXPStyle::drawControl(), QWindowsStyle::drawControl(), QGtkStyle::drawControl(), QMacStyle::drawControl(), QStyleSheetStyle::drawControl(), QDirectFBPaintEngine::drawImage(), QGraphicsScenePrivate::drawItemHelper(), QDirectFBPaintEngine::drawPixmap(), QWindowsVistaStyle::drawPrimitive(), QPlastiqueStyle::drawPrimitive(), effectiveState(), QScrollArea::ensureWidgetVisible(), QX11PaintEnginePrivate::fillPolygon_dev(), QDockAreaLayoutInfo::fitItems(), QToolBarAreaLayoutLine::fitLayout(), QGLWindowSurface::flush(), QWSYellowSurface::flush(), fromLayoutItemSize(), QDockAreaLayout::gapRect(), QWaylandReadbackEglContext::geometryChanged(), QWaylandReadbackGlxContext::geometryChanged(), QWaylandXCompositeEGLContext::geometryChanged(), QWaylandXCompositeGLXContext::geometryChanged(), QDockAreaLayout::getGrid(), getNetWmState(), QSplitterPrivate::getRange(), QPixmap::grabWidget(), QXcbWindow::handleConfigureNotifyEvent(), handleSizeAttribute(), QColorDialogPrivate::init(), QMacStylePrivate::initComboboxBdi(), QDockAreaLayoutInfo::insertGap(), isFullUpdate(), QDockAreaLayoutInfo::itemRect(), make_win_eventUPP(), QAbstractSpinBox::minimumSizeHint(), QTabBar::minimumSizeHint(), QIconModeViewBase::moveItem(), QToolBarAreaLayoutInfo::moveToolBar(), QWaylandEglWindow::newSurfaceCreated(), QSvgIconEngine::paint(), QDeclarativePaintedItem::paint(), QIcon::paint(), QFontFamilyDelegate::paint(), QPixmapIconEngine::paint(), QIconLoaderEngine::paint(), QGtkPainter::paintArrow(), QScreen::paintBackground(), QGtkPainter::paintBox(), QGtkPainter::paintBoxGap(), QGtkPainter::paintCheckbox(), QLabel::paintEvent(), QGtkPainter::paintExpander(), QGtkPainter::paintExtention(), QGtkPainter::paintFlatBox(), QGtkPainter::paintFocus(), QGtkPainter::paintHandle(), QGtkPainter::paintHline(), QGtkPainter::paintOption(), QGtkPainter::paintResizeGrip(), QGtkPainter::paintShadow(), QGtkPainter::paintSlider(), QGtkPainter::paintVline(), QGraphicsWidget::paintWindowFrame(), QGraphicsItemEffectSourcePrivate::pixmap(), QWidgetEffectSourcePrivate::pixmap(), QDockAreaLayoutInfo::plug(), QWidgetPrivate::pointToRect(), QRasterWindowSurface::prepareBuffer(), QGLPixmapBlurFilter::processGL(), QGLPixmapDropShadowFilter::processGL(), QBalloonTip::QBalloonTip(), QFbScreen::QFbScreen(), QRectF::QRectF(), qt_cleanup(), qt_defaultDpiX(), qt_defaultDpiY(), qt_grab_cursor(), qt_mac_grabDisplayRect(), qt_mac_update_widget_position(), qt_plastique_draw_gradient(), qt_tablet_cleanup_wce(), QtWndProc(), QVNCDirtyMap::QVNCDirtyMap(), qWinProcessConfigRequests(), QSvgIOHandler::read(), read_jpeg_image(), QWidgetPrivate::render_helper(), QAbstractItemViewPrivate::renderToPixmap(), QTreeViewPrivate::renderTreeToPixmapForAnimation(), QVFbWindowSurface::resize(), QWorkspaceChild::resizeEvent(), QBBScreen::resizeTopLevelWindow(), QWidget::restoreGeometry(), QDockAreaLayoutInfo::restoreState(), QDockAreaLayout::saveState(), QPageSetupWidget::selectPrinter(), QWidgetPrivate::sendPendingMoveAndResizeEvents(), QDockAreaLayoutInfo::separatorRect(), QWidget::setContentsMargins(), QToolBarLayout::setExpanded(), QFbScreen::setFormat(), QDirectFbWindow::setGeometry(), ShivaVGWindowSurface::setGeometry(), QOpenKODEWindow::setGeometry(), QX11GLWindowSurface::setGeometry(), QMacWindowSurface::setGeometry(), QDirectFBWindowSurface::setGeometry(), QWSWindowSurface::setGeometry(), QX11WindowSurface::setGeometry(), QToolBarLayout::setGeometry(), QWidgetItem::setGeometry(), QFbScreen::setGeometry(), QWSLocalMemSurface::setGeometry(), QWSSharedMemSurface::setGeometry(), QWidget::setGeometry(), QMdiSubWindowPrivate::setNewGeometry(), QBBScreen::setRotation(), QTabBarPrivate::setupMovableTab(), setWindowGeometry(), QEglFSPaintDevice::size(), QFontMetrics::size(), QDockAreaLayoutInfo::size(), QMacStyle::sizeFromContents(), QRadioButton::sizeHint(), QCheckBox::sizeHint(), QAbstractSpinBox::sizeHint(), QVideoSurfaceFormat::sizeHint(), QTabBar::sizeHint(), QDateTimeEdit::sizeHint(), QComboMenuDelegate::sizeHint(), QSplitter::sizes(), QSplitterPrivate::storeSizes(), QMacStyle::styleHint(), QCommonStyle::subElementRect(), QMacStyle::subElementRect(), QWaylandXCompositeEGLContext::swapBuffers(), QWaylandReadbackGlxContext::swapBuffers(), QWaylandReadbackEglContext::swapBuffers(), QWaylandXCompositeGLXContext::swapBuffers(), QBBGLContext::swapBuffers(), QWidgetBackingStore::sync(), toLayoutItemSize(), toVGImageWithOpacitySubRect(), QDirectFBPixmapData::transformed(), QETWidget::translateConfigEvent(), QIconModeViewBase::updateContentsSize(), QGLWindowSurface::updateGeometry(), QComboBoxPrivate::updateLineEditGeometry(), QDeclarativeTextPrivate::updateSize(), QMessageBoxPrivate::updateSize(), QWidgetBackingStore::updateStaticContentsSize(), QCommonStylePrivate::viewItemLayout(), and QVGEGLWindowSurfacePrivate::windowSurfaceSize().

310 { return QSize(width(), height()); }
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53

◆ top()

int QRect::top ( ) const
inline

Returns the y-coordinate of the rectangle's top edge.

Equivalent to y().

See also
setTop(), topLeft(), topRight()

Definition at line 243 of file qrect.h.

Referenced by _q_interpolate(), QLabelPrivate::_q_movieUpdated(), QSpanBuffer::addSpan(), QRasterPaintEngine::alphaPenBlt(), QRegionPrivate::append(), QDockAreaLayoutInfo::apply(), QToolBarAreaLayout::apply(), QPicturePaintEngine::begin(), QAhiScreen::blit(), blit180(), blit270(), blit90(), QGLFramebufferObject::blitFramebuffer(), blitTexture(), QGroupBoxPrivate::calculateFrame(), QRegionPrivate::canAppend(), canMergeFromBelow(), canMergeFromRight(), QRegionPrivate::canPrepend(), clearRect(), QBspTree::climbTree(), clipStraightLine(), constrainedRect(), QRegion::contains(), QRegionPrivate::contains(), containsViewport(), convolute(), correctNormalized(), QOleDropSource::createCursors(), QToolBarAreaLayoutInfo::distance(), QGridLayoutPrivate::distribute(), QAbstractItemView::doAutoScroll(), QLabelPrivate::documentRect(), QIconModeViewBase::doDynamicLayout(), QItemDelegate::doLayout(), QFbScreen::doRedraw(), QLayoutPrivate::doResize(), QListModeViewBase::doStaticLayout(), QListModeViewBase::dragMoveEvent(), QAbstractItemView::dragMoveEvent(), QVistaHelper::drawBlackRect(), QStyleHelper::drawBorderPixmap(), QTreeView::drawBranches(), QWindowsVistaStyle::drawComplexControl(), QPlastiqueStyle::drawComplexControl(), QCleanlooksStyle::drawComplexControl(), QWindowsXPStyle::drawComplexControl(), QGtkStyle::drawComplexControl(), QMotifStyle::drawComplexControl(), QCommonStyle::drawControl(), QWindowsCEStyle::drawControl(), QWindowsVistaStyle::drawControl(), QPlastiqueStyle::drawControl(), QWindowsMobileStyle::drawControl(), QCleanlooksStyle::drawControl(), QWindowsXPStyle::drawControl(), QWindowsStyle::drawControl(), QGtkStyle::drawControl(), QMotifStyle::drawControl(), QMacStyle::drawControl(), QStyleSheetStyle::drawControl(), QGraphicsScenePrivate::drawItemHelper(), QGLEllipseMaskGenerator::drawMask(), QWindowsCEStyle::drawPrimitive(), QCommonStyle::drawPrimitive(), QWindowsVistaStyle::drawPrimitive(), QWindowsMobileStyle::drawPrimitive(), QPlastiqueStyle::drawPrimitive(), QCleanlooksStyle::drawPrimitive(), QWindowsStyle::drawPrimitive(), QGtkStyle::drawPrimitive(), QMotifStyle::drawPrimitive(), QMacStyle::drawPrimitive(), QX11PaintEngine::drawRects(), QWindowsMobileStylePrivate::drawScrollbarGrip(), QVistaHelper::drawTitleBar(), QVistaHelper::drawTitleText(), QTreeView::drawTree(), QBoxLayoutPrivate::effectiveMargins(), QGridLayoutPrivate::effectiveMargins(), effectiveState(), QPSPrintEnginePrivate::emitHeader(), QPicturePaintEngine::end(), QPlainTextEditPrivate::ensureCursorVisible(), QScrollArea::ensureWidgetVisible(), QScriptEdit::extraAreaPaintEvent(), QRasterPaintEngine::fillPath(), QToolBarAreaLayoutInfo::fitLayout(), QToolBarAreaLayout::fitLayout(), QDockAreaLayout::fitLayout(), QWindowsXPStylePrivate::fixAlphaChannel(), QGLWindowSurface::flush(), QWidgetPrivate::frameStrut(), QDockAreaLayout::gapIndex(), QMdi::MinOverlapPlacer::getCandidatePlacements(), QDockAreaLayout::getGrid(), getNetWmState(), QVNCIntegration::grabWindow(), grayscale(), QWindowsXPStylePrivate::hasAlphaChannel(), QWindowsXPStylePrivate::hasAnyData(), QClipData::initialize(), QListModeViewBase::initStaticLayout(), QListModeViewBase::intersectingSet(), intersectsViewport(), isEmptyHelper(), isServerProcess(), QRasterPaintEnginePrivate::isUnclipped(), QRasterPaintEnginePrivate::isUnclipped_normalized(), QToolBarAreaLayoutInfo::itemRect(), QWidgetResizeHandler::keyPressEvent(), QAbstractScrollAreaPrivate::layoutChildren(), QTabBarPrivate::layoutTabs(), make_win_eventUPP(), QTabBarPrivate::makeVisible(), QMatrix::mapRect(), QTransform::mapRect(), QRegionPrivate::mergeFromAbove(), miCoalesce(), miRegionOp(), miSetExtents(), QWidgetResizeHandler::mouseMoveEvent(), QVistaHelper::mouseMoveEvent(), QListView::moveCursor(), QToolBarAreaLayoutInfo::moveToolBar(), QAccessibleWidget::navigate(), QDockWidgetPrivate::nonClientAreaMouseEvent(), operator<<(), QRectF::operator|(), QPdfEnginePrivate::pageMatrix(), QPdfBaseEnginePrivate::pageRect(), QScriptDebuggerLocalsItemDelegate::paint(), QGtkPainter::paintBox(), QGtkPainter::paintBoxGap(), QVistaBackButton::paintEvent(), QTableView::paintEvent(), QTabBar::paintEvent(), QHeaderView::paintEvent(), QPlainTextEdit::paintEvent(), QWorkspacePrivate::place(), QWidgetPrivate::pointToRect(), PolygonRegion(), QMenu::popup(), QMenuBarPrivate::popupAction(), QAbstractItemViewPrivate::position(), QDateTimeEditPrivate::positionCalendarPopup(), QRegionPrivate::prepend(), QGLPixmapDropShadowFilter::processGL(), PtsToRegion(), qDrawBorderPixmap(), QPolygon::QPolygon(), QRect_unite(), QRectF::QRectF(), qRectIntersects(), qstring_to_xtp(), qt_add_rect(), qt_bitmapToRegion(), qt_cleanlooks_draw_buttongradient(), qt_cleanlooks_draw_gradient(), qt_cleanlooks_draw_mdibutton(), qt_grab_cursor(), qt_intersect_spans(), qt_mac_create_window(), qt_mac_unregister_widget(), qt_plastique_draw_frame(), qt_plastique_draw_gradient(), qt_plastique_draw_handle(), qt_plastique_draw_mdibutton(), qt_plastique_drawFrame(), qt_rect_intersect_normalized(), qt_region_strictContains(), qt_scale_image_16bit(), qt_scale_image_32bit(), qt_tablet_cleanup_wce(), qt_transform_image_rasterize(), qt_wince_full_screen(), QtWndProc(), QGLMaskTextureCache::quadtreeClear(), QGLMaskTextureCache::quadtreeInsert(), QRasterizer::rasterize(), QRasterizer::rasterizeLine(), rect_intersects(), RectInRegion(), QDecorationStyled::region(), QDecorationWindows::region(), QDecorationDefault::region(), QGraphicsView::render(), QTreeViewPrivate::renderTreeToPixmapForAnimation(), QFbWindow::repaint(), QScriptEdit::resizeEvent(), QWidget::restoreGeometry(), QX11PixmapData::scroll(), QListViewPrivate::scrollElasticBandBy(), QMenuPrivate::scrollMenu(), QTreeView::scrollTo(), QDockAreaLayout::separatorRect(), QLinuxFbScreen::setDirty(), QWidget::setDisabled(), QFrame::setFrameRect(), QBoxLayout::setGeometry(), QMainWindowLayout::setGeometry(), QWidgetPrivate::setGeometry_sys(), QDockAreaLayout::setGrid(), QWidgetPrivate::setLayoutItemMargins(), QRegion::setRects(), QGL2PaintEngineExPrivate::setScissor(), QTableView::setSelection(), QListView::setSelection(), QTreeView::setSelection(), QBoxLayoutPrivate::setupGeom(), QGridLayoutPrivate::setupSpacings(), QWidget::setWindowState(), QAbstractItemViewPrivate::shouldAutoScroll(), QCompleterPrivate::showPopup(), QComboBox::showPopup(), showYellowThing_win(), QAhiScreen::solidFill(), spacingHelper(), QPlastiqueStyle::styleHint(), QCleanlooksStyle::styleHint(), QMacStyle::styleHint(), QPlastiqueStyle::subControlRect(), QCleanlooksStyle::subControlRect(), QMacStyle::subControlRect(), QGtkStyle::subControlRect(), QStyleSheetStyle::subControlRect(), QCommonStyle::subElementRect(), QMacStyle::subElementRect(), QMotifStyle::subElementRect(), QWindowsXPStylePrivate::swapAlphaChannel(), QCommonStylePrivate::tabLayout(), QPlainTextEdit::timerEvent(), QTextEdit::timerEvent(), QCommandLinkButtonPrivate::titleRect(), QTest::toString(), QETWidget::translateTabletEvent(), UnionRegion(), QOpenGLPaintEnginePrivate::updateDepthClip(), QTableView::updateGeometries(), updateRedirectedToGraphicsProxyWidget(), QMdiAreaPrivate::updateScrollBars(), QFramePrivate::updateStyledFrameWidths(), QWorkspacePrivate::updateWorkspace(), useScrollBar(), QCommonListViewBase::verticalScrollToValue(), QListViewPrivate::verticalScrollToValue(), QCommonStylePrivate::viewItemLayout(), QTreeView::visualRegionForSelection(), and QRegionPrivate::within().

244 { return y1; }
int y1
Definition: qrect.h:177

◆ topLeft()

QPoint QRect::topLeft ( ) const
inline

Returns the position of the rectangle's top-left corner.

See also
setTopLeft(), top(), left()

Definition at line 288 of file qrect.h.

Referenced by QLabelPrivate::_q_movieUpdated(), _q_paintIntoCache(), QPushButtonPrivate::adjustedMenuPosition(), blendCursor(), QScreen::blit(), QVGCompositionHelper::blitWindow(), QWidgetBackingStore::bltRect(), QGraphicsItem::boundingRegion(), buttonChange(), QPlatformSoftwareCursor::changeCursor(), QAccessibleTextWidget::characterRect(), QAccessibleLineEdit::characterRect(), QWidgetPrivate::childAtRecursiveHelper(), QWidgetPrivate::clipToEffectiveMask(), QScreen::compose(), convolute(), QMultiScreen::createSurface(), QWidgetBackingStore::dirtyRegion(), do_size_hints(), dockPosHelper(), QSplitterPrivate::doMove(), QFbScreen::doRedraw(), QSplitterPrivate::doResize(), QPixmapConvolutionFilter::draw(), QItemDelegate::drawBackground(), QPlastiqueStyle::drawComplexControl(), QCleanlooksStyle::drawComplexControl(), QWindowsXPStyle::drawComplexControl(), QMotifStyle::drawComplexControl(), QStyleSheetStyle::drawComplexControl(), QSplashScreen::drawContents(), QDeclarativeTextInput::drawContents(), QWindowsCEStyle::drawControl(), QWindowsVistaStyle::drawControl(), QWindowsMobileStyle::drawControl(), QPlastiqueStyle::drawControl(), QCleanlooksStyle::drawControl(), QWindowsXPStyle::drawControl(), QWindowsStyle::drawControl(), QGtkStyle::drawControl(), QMotifStyle::drawControl(), QMacStyle::drawControl(), QStyleSheetStyle::drawControl(), QPlatformSoftwareCursor::drawCursor(), QItemDelegate::drawDisplay(), QX11PaintEngine::drawEllipse(), QOpenGLPaintEnginePrivate::drawItem(), QGraphicsScenePrivate::drawItemHelper(), QGLTrapezoidMaskGenerator::drawMask(), QWindowsMobileStylePrivate::drawPanelItemViewSelected(), QPlastiqueStylePrivate::drawPartialFrame(), QRasterPaintEngine::drawPixmap(), QWindowsCEStyle::drawPrimitive(), QWindowsVistaStyle::drawPrimitive(), QCommonStyle::drawPrimitive(), QWindowsMobileStyle::drawPrimitive(), QPlastiqueStyle::drawPrimitive(), QCleanlooksStyle::drawPrimitive(), QWindowsStyle::drawPrimitive(), QGtkStyle::drawPrimitive(), QMacStyle::drawPrimitive(), QX11PaintEngine::drawRects(), QWindowsMobileStylePrivate::drawScrollbarGrip(), QWindowsMobileStylePrivate::drawScrollbarHandleDown(), QGraphicsScenePrivate::drawSubtreeRecursive(), QWindowsMobileStylePrivate::drawTabBarTab(), drawTabShape(), effectiveState(), QScrollArea::ensureWidgetVisible(), QDockWidget::event(), QScreen::exposeRegion(), fillRegion(), QIconModeViewBase::filterDropEvent(), QIconModeViewBase::filterStartDrag(), QDockAreaLayoutInfo::fitItems(), fixToolBarOrientation(), QXcbWindowSurface::flush(), QX11WindowSurface::flush(), QWSWindowSurface::flush(), QGLWindowSurface::flush(), QRasterWindowSurface::flush(), QDockAreaLayout::gapRect(), QFbScreen::generateRects(), QPlatformSoftwareCursor::getCurrentRect(), getNetWmState(), QWidgetPrivate::getOpaqueChildren(), QSplitterPrivate::getRange(), handlePositionAttribute(), QTabWidget::initStyleOption(), QDockAreaLayoutInfo::insertGap(), QWidgetPrivate::isOverlapped(), isServerProcess(), QDockAreaLayoutInfo::itemRect(), QAbstractScrollAreaPrivate::layoutChildren(), QLabelPrivate::layoutPoint(), QTabBarPrivate::layoutTab(), make_widget_eventUPP(), make_win_eventUPP(), QWidget::mapFromGlobal(), QWidget::mapFromParent(), QMatrix4x4::mapRect(), QWidget::mapToGlobal(), QWidget::mapToParent(), QWidgetResizeHandler::mouseMoveEvent(), QTabBar::mouseMoveEvent(), QColorPicker::mouseMoveEvent(), QScrollBar::mousePressEvent(), QSlider::mousePressEvent(), QCalendarPopup::mousePressEvent(), QColorPicker::mousePressEvent(), QSplitter::moveSplitter(), QWindowSurface::offset(), QGraphicsProxyWidget::paint(), QGtkPainter::paintArrow(), QScreen::paintBackground(), QGtkPainter::paintBox(), QGtkPainter::paintBoxGap(), QWellArray::paintCellContents(), QGtkPainter::paintCheckbox(), QWSWindowSurface::painterOffset(), QWSMemorySurface::painterOffset(), QWSOnScreenSurface::painterOffset(), QVistaBackButton::paintEvent(), QColorPicker::paintEvent(), QGtkPainter::paintExpander(), QGtkPainter::paintExtention(), QGtkPainter::paintFlatBox(), QGtkPainter::paintFocus(), QGtkPainter::paintHandle(), QGtkPainter::paintHline(), QGtkPainter::paintOption(), QGtkPainter::paintResizeGrip(), QHeaderView::paintSection(), QGtkPainter::paintShadow(), QWidgetPrivate::paintSiblingsRecursive(), QGtkPainter::paintSlider(), QGtkPainter::paintVline(), parseGeometry(), QGraphicsItemEffectSourcePrivate::pixmap(), QWidgetEffectSourcePrivate::pixmap(), QDockAreaLayoutInfo::plug(), QMainWindowLayout::plug(), QPlatformSoftwareCursor::pointerEvent(), QMenu::popup(), QMenuBarPrivate::popupAction(), QToolButtonPrivate::popupTimerDone(), qDrawBorderPixmap(), qt_cleanup(), qt_grab_cursor(), qt_mac_get_widget_rgn(), qt_mac_grabDisplayRect(), qt_mac_posInWindow(), qt_mac_unregister_widget(), qt_mac_update_widget_position(), qt_scrollRectInImage(), qt_tablet_cleanup_wce(), qWinProcessConfigRequests(), QRasterizer::rasterizeLine(), QSvgIOHandler::read(), read_jpeg_image(), QAccessibleToolButton::rect(), QAccessibleDockWidget::rect(), QAccessibleTitleBar::rect(), QWidgetPrivate::render(), QAbstractItemViewPrivate::renderToPixmap(), QTreeViewPrivate::renderTreeToPixmapForAnimation(), QWorkspaceChild::resizeEvent(), QBBScreen::resizeNativeWidgetWindow(), QWidget::restoreGeometry(), QDockAreaLayoutInfo::restoreState(), QGraphicsItem::scroll(), QWidgetPrivate::scroll_sys(), QWidgetPrivate::sendPendingMoveAndResizeEvents(), QDockAreaLayoutInfo::separatorRect(), QWSWindowSurface::setClipRegion(), QFbScreen::setDirty(), QWidget::setDisabled(), QDirectFbWindow::setGeometry(), QOpenKODEWindow::setGeometry(), QBBWindow::setGeometry(), QWSWindowSurface::setGeometry(), QToolBarLayout::setGeometry(), QWSLocalMemSurface::setGeometry(), QWidget::setGeometry(), QWidgetPrivate::setGeometry_sys(), QWidget::setMask(), QMdiSubWindowPrivate::setNewGeometry(), QXcbWindow::setParent(), QXlibWindow::setParent(), setWindowGeometry(), QMdiSubWindow::showSystemMenu(), QAbstractItemView::startDrag(), QStyleSheetStyle::subControlRect(), QWidgetPrivate::subtractOpaqueSiblings(), QWidgetBackingStore::sync(), QMainWindowLayout::toggleToolBarsVisible(), QPaintEnginePrivate::transformSystemClip(), QETWidget::translateConfigEvent(), QWSInputContext::translateIMQueryEvent(), QETWidget::translateMouseEvent(), QImage::trueMatrix(), QWinInputContext::update(), updateRedirectedToGraphicsProxyWidget(), QDesktopWidgetPrivate::updateScreenList(), QDockAreaLayoutInfo::updateSeparatorWidgets(), QDockAreaLayout::updateSeparatorWidgets(), QCommonStylePrivate::viewItemDrawText(), and QVGEGLWindowSurfacePrivate::windowSurfaceSize().

289 { return QPoint(x1, y1); }
int y1
Definition: qrect.h:177
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
int x1
Definition: qrect.h:178

◆ topRight()

QPoint QRect::topRight ( ) const
inline

Returns the position of the rectangle's top-right corner.

Note that for historical reasons this function returns QPoint(left() + width() -1, top()).

See also
setTopRight(), top(), right()

Definition at line 294 of file qrect.h.

Referenced by QToolBarAreaLayout::apply(), QTransformedScreen::blit(), QPlastiqueStyle::drawComplexControl(), QCleanlooksStyle::drawComplexControl(), QWindowsCEStyle::drawControl(), QWindowsVistaStyle::drawControl(), QWindowsMobileStyle::drawControl(), QPlastiqueStyle::drawControl(), QCleanlooksStyle::drawControl(), QWindowsXPStyle::drawControl(), QWindowsStyle::drawControl(), QGtkStyle::drawControl(), QMacStyle::drawControl(), QStyleSheetStyle::drawControl(), QWindowsMobileStylePrivate::drawPanelItemViewSelected(), QPlastiqueStylePrivate::drawPartialFrame(), QCommonStyle::drawPrimitive(), QWindowsMobileStyle::drawPrimitive(), QPlastiqueStyle::drawPrimitive(), QCleanlooksStyle::drawPrimitive(), QWindowsStyle::drawPrimitive(), QGtkStyle::drawPrimitive(), QMacStyle::drawPrimitive(), QWindowsMobileStylePrivate::drawScrollbarGrip(), QWindowsMobileStylePrivate::drawScrollbarHandleDown(), QWindowsMobileStylePrivate::drawScrollbarHandleUp(), QWindowsMobileStylePrivate::drawTabBarTab(), QTabBar::mouseMoveEvent(), QWellArray::paintCellContents(), QToolButtonPrivate::popupTimerDone(), and QStyleSheetStyle::subControlRect().

295 { return QPoint(x2, y1); }
int y1
Definition: qrect.h:177
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
int x2
Definition: qrect.h:180

◆ translate() [1/2]

void QRect::translate ( int  dx,
int  dy 
)
inline

Moves the rectangle dx along the x axis and dy along the y axis, relative to the current position.

Positive values move the rectangle to the right and down.

See also
moveTopLeft(), moveTo(), translated()

Definition at line 312 of file qrect.h.

Referenced by QLabelPrivate::_q_movieUpdated(), QTextEditPrivate::_q_repaintContents(), QPlainTextEditPrivate::_q_repaintContents(), QWSMemorySurface::beginPaint(), QRectF::bottomLeft(), QGLWindowSurface::buffer(), QAccessibleTextWidget::characterRect(), QPlainTextEdit::cursorRect(), QTextEdit::cursorRect(), QWidgetBackingStore::dirtyRegion(), do_size_hints(), QIconModeViewBase::draggedItemsRect(), QTableViewPrivate::drawAndClipSpans(), QMotifStyle::drawComplexControl(), QMacStyle::drawComplexControl(), QCommonStyle::drawControl(), QWindowsCEStyle::drawControl(), QWindowsMobileStyle::drawControl(), QCleanlooksStyle::drawControl(), QWindowsStyle::drawControl(), QGtkStyle::drawControl(), QMacStyle::drawControl(), QStyleSheetStyle::drawControl(), QGtkStyle::drawPrimitive(), QX11PaintEngine::drawRects(), QPSPrintEnginePrivate::emitHeader(), QVNCServer::frameBufferUpdateRequest(), QPlatformSoftwareCursor::getCurrentRect(), QX11GLWindowSurface::grabWidget(), QX11WindowSurface::grabWidget(), QWindowSurface::grabWidget(), QWidgetPrivate::handleSoftwareInputPanel(), QWidgetPrivate::isOverlapped(), isServerProcess(), QGraphicsScenePrivate::markDirty(), QMenuPrivate::mouseEventTaken(), QListView::moveCursor(), QBBWindow::offset(), OffsetRegion(), QTextEditPrivate::paint(), QWellArray::paintEvent(), QWhatsThat::paintEvent(), QMenu::paintEvent(), QHeaderView::paintEvent(), QStyleSheetStyle::positionRect(), QGraphicsScenePrivate::processDirtyItemsRecursive(), QMacPrintEngine::property(), qt_grab_cursor(), qt_mac_update_widget_position(), read_jpeg_image(), QAccessibleItemRow::rect(), QAccessibleTextEdit::rect(), QAccessibleTable2Cell::rect(), QWidgetPrivate::scroll_sys(), QColorPicker::setCol(), QWidgetBackingStore::showYellowThing(), QAccessibleTable2Cell::state(), QWindowsVistaStyle::subControlRect(), QPlastiqueStyle::subControlRect(), QCleanlooksStyle::subControlRect(), QMacStyle::subControlRect(), QCommonStyle::subElementRect(), QTabBar::tabRect(), QStyleSheetStyle::titleBarLayout(), translateBySips(), QMenuPrivate::updateActionRects(), QGraphicsItemPrivate::updatePaintedViewBoundingRects(), QColumnView::visualRect(), and QStyle::visualRect().

313 {
314  x1 += dx;
315  y1 += dy;
316  x2 += dx;
317  y2 += dy;
318 }
int y1
Definition: qrect.h:177
int y2
Definition: qrect.h:179
int x2
Definition: qrect.h:180
int x1
Definition: qrect.h:178

◆ translate() [2/2]

void QRect::translate ( const QPoint offset)
inline

Moves the rectangle {offset}.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

x() along the x axis and {offset}.y() along the y axis, relative to the current position.

Definition at line 320 of file qrect.h.

321 {
322  x1 += p.x();
323  y1 += p.y();
324  x2 += p.x();
325  y2 += p.y();
326 }
int y1
Definition: qrect.h:177
int y2
Definition: qrect.h:179
int x2
Definition: qrect.h:180
int x1
Definition: qrect.h:178

◆ translated() [1/2]

QRect QRect::translated ( int  dx,
int  dy 
) const
inline

Returns a copy of the rectangle that is translated dx along the x axis and dy along the y axis, relative to the current position.

Positive values move the rectangle to the right and down.

See also
translate()

Definition at line 328 of file qrect.h.

Referenced by QLineEditPrivate::adjustedControlRect(), blendCursor(), QTransformedScreen::blit(), QVGCompositionHelper::blitWindow(), QRectF::bottomLeft(), QGraphicsItem::boundingRegion(), buttonChange(), QPlatformSoftwareCursor::changeCursor(), QWidgetBackingStore::dirtyRegion(), QFbScreen::doRedraw(), QWindowsXPStylePrivate::drawBackgroundDirectly(), QRenderRule::drawBackgroundImage(), QCommonStyle::drawComplexControl(), QDeclarativeTextEdit::drawContents(), QPlatformSoftwareCursor::drawCursor(), QRasterPaintEngine::drawImage(), QRasterPaintEngine::drawRects(), effectiveState(), QIconModeViewBase::filterDragMoveEvent(), QXcbWindowSurface::flush(), QX11GLWindowSurface::flush(), QGLWindowSurface::flush(), QRasterWindowSurface::flush(), QWidgetPrivate::frameStrut(), QFbScreen::generateRects(), QPlatformSoftwareCursor::getCurrentRect(), QPlainTextEdit::inputMethodQuery(), QTextEdit::inputMethodQuery(), QGraphicsTextItem::inputMethodQuery(), QGraphicsProxyWidgetPrivate::inputMethodQueryHelper(), QTransform::mapRect(), QGraphicsViewPrivate::mapRectToScene(), QGraphicsViewPrivate::mapToViewRect(), QWidgetBackingStore::markDirty(), PvrEglWindowSurface::move(), QAbstractButtonPrivate::moveFocus(), QWidgetPrivate::moveRect(), QWSMemorySurface::painterOffset(), QListView::paintEvent(), QPlatformSoftwareCursor::pointerEvent(), qt_mac_grabDisplayRect(), qt_mac_grabScreenRect(), qt_scrollRectInImage(), QGLMaskTextureCache::quadtreeClear(), QGLMaskTextureCache::quadtreeInsert(), QVNCDirtyMap::QVNCDirtyMap(), QWindowSurface::rect(), QAccessibleMenuItem::rect(), QAccessibleTextEdit::rect(), QAccessibleItemView::rect(), QGLWindowSurface::scroll(), QPixmap::scroll(), QGraphicsItem::scroll(), QWidget::scroll(), QWidgetPrivate::scroll_sys(), QWidgetPrivate::scrollRect(), QVFbScreen::setDirty(), QFbScreen::setDirty(), QVNCScreenPrivate::setDirty(), QWSLocalMemSurface::setGeometry(), QListView::setSelection(), QWidgetBackingStore::staticContents(), QWindowsXPStyle::subElementRect(), QWidgetPrivate::subtractOpaqueSiblings(), QDirectFBScreen::surfaceForWidget(), QWidgetBackingStore::sync(), QETWidget::translatePaintEvent(), QDeclarativeTextEdit::updateImgCache(), updateRedirectedToGraphicsProxyWidget(), QVGEGLWindowSurfacePrivate::windowSurfaceSize(), QRfbRawEncoder::write(), and QRfbHextileEncoder< SRC >::write().

329 { return QRect(QPoint(x1 + dx, y1 + dy), QPoint(x2 + dx, y2 + dy)); }
int y1
Definition: qrect.h:177
int y2
Definition: qrect.h:179
QRect()
Constructs a null rectangle.
Definition: qrect.h:61
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
int x2
Definition: qrect.h:180
int x1
Definition: qrect.h:178

◆ translated() [2/2]

QRect QRect::translated ( const QPoint offset) const
inline

Returns a copy of the rectangle that is translated {offset}.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

x() along the x axis and {offset}.y() along the y axis, relative to the current position.

Definition at line 331 of file qrect.h.

332 { return QRect(QPoint(x1 + p.x(), y1 + p.y()), QPoint(x2 + p.x(), y2 + p.y())); }
int y1
Definition: qrect.h:177
int y2
Definition: qrect.h:179
QRect()
Constructs a null rectangle.
Definition: qrect.h:61
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
int x2
Definition: qrect.h:180
int x1
Definition: qrect.h:178

◆ unite()

QRect QRect::unite ( const QRect rectangle) const
inline

Use united(rectangle) instead.

Definition at line 486 of file qrect.h.

Referenced by QRectF::bottomLeft(), united(), and QWorkspacePrivate::updateWorkspace().

487 {
488  return *this | r;
489 }

◆ united()

QRect QRect::united ( const QRect rectangle) const
inline

◆ width()

int QRect::width ( ) const
inline

Returns the width of the rectangle.

See also
setWidth(), height(), size()

Definition at line 303 of file qrect.h.

Referenced by _q_adjustRect(), QTextEditPrivate::_q_ensureVisible(), QLabelPrivate::_q_movieUpdated(), QWindowsAccessible::accLocation(), QMdi::MinOverlapPlacer::accumulatedOverlap(), QPushButtonPrivate::adjustedMenuPosition(), QWidgetPrivate::adjustedSize(), QDialog::adjustPosition(), QLayout::alignmentRect(), QDockAreaLayoutInfo::apply(), QWorkspace::arrangeIcons(), QFormLayoutPrivate::arrangeWidgets(), QBBScreen::availableGeometry(), QBalloonTip::balloon(), QPicturePaintEngine::begin(), QPainter::begin(), blendCursor(), QAhiScreen::blit(), QDirectFBPaintEnginePrivate::blit(), blit180(), blit270(), blit90(), blit_template(), QGLFramebufferObject::blitFramebuffer(), QVGCompositionHelper::blitWindow(), QRectF::bottomLeft(), QGraphicsItem::boundingRegion(), QMenuBarPrivate::calcActionRects(), calcArrow(), QPrintPreviewWidgetPrivate::calcCurrentPage(), QStyleHelper::calcLines(), QStyleHelper::calcRadialPos(), QRegionPrivate::canPrepend(), QComboBox::changeEvent(), QDesktopWidgetPrivate::cleanup(), QVGPaintEngine::clearRect(), QPaintEngineEx::clip(), clipLine(), QSplitterHandle::closestLegalPosition(), QColorPicker::colPt(), QScreen::compose(), QMultiScreen::connect(), constrainedRect(), QRegion::contains(), QWidget::contentsRect(), QMacPixmapData::copy(), QDirectFBPixmapData::copy(), QX11PixmapData::copy(), QVGPixmapData::copy(), QGLPixmapData::copy(), QImage::copy(), QBBWindow::copyBack(), QVolatileImage::copyFrom(), QWidgetPrivate::create_sys(), QOleDropSource::createCursors(), QDirectFBScreen::createDFBSurface(), QDirectFBScreen::createSurface(), QDirectFBWindowSurface::createWindow(), QWaylandWindow::damage(), QStyleSheetStyle::defaultSize(), QMacScrollOptimization::delayScroll(), QDeclarativePaintedItem::dirtyCache(), QGridLayoutPrivate::distribute(), do_size_hints(), dockPosHelper(), QETWidget::doDeferredMap(), QItemDelegate::doLayout(), QXlibWindow::doSizeHints(), QListModeViewBase::doStaticLayout(), QAbstractItemView::dragMoveEvent(), QVGPixmapConvolutionFilter::draw(), QVGPixmapColorizeFilter::draw(), QVGPixmapDropShadowFilter::draw(), QVGPixmapBlurFilter::draw(), QRenderRule::drawBackgroundImage(), QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(), QVistaHelper::drawBlackRect(), QStyleHelper::drawBorderPixmap(), QWindowsVistaStyle::drawComplexControl(), QWindowsCEStyle::drawComplexControl(), QCommonStyle::drawComplexControl(), QPlastiqueStyle::drawComplexControl(), QWindowsMobileStyle::drawComplexControl(), QCleanlooksStyle::drawComplexControl(), QWindowsStyle::drawComplexControl(), QWindowsXPStyle::drawComplexControl(), QGtkStyle::drawComplexControl(), QMotifStyle::drawComplexControl(), QStyleSheetStyle::drawComplexControl(), QMacStyle::drawComplexControl(), QSplashScreen::drawContents(), QWindowsCEStyle::drawControl(), QWindowsVistaStyle::drawControl(), QCommonStyle::drawControl(), QPlastiqueStyle::drawControl(), QWindowsMobileStyle::drawControl(), QCleanlooksStyle::drawControl(), QWindowsXPStyle::drawControl(), QWindowsStyle::drawControl(), QGtkStyle::drawControl(), QMotifStyle::drawControl(), QMacStyle::drawControl(), QStyleSheetStyle::drawControl(), QStyleHelper::drawDial(), QItemDelegate::drawDisplay(), QX11PaintEngine::drawEllipse(), QPainter::drawEllipse(), drawEllipse_midpoint_i(), drawEllipsePoints(), QX11PaintEngine::drawFreetype(), QRasterPaintEngine::drawImage(), QRasterPaintEnginePrivate::drawImage(), drawImageTiled(), QGraphicsScenePrivate::drawItemHelper(), QGLTrapezoidMaskGenerator::drawMask(), QWindowsMobileStylePrivate::drawPanelItemViewSelected(), QVGPaintEngine::drawPixmapFragments(), QDirectFbBlitter::drawPixmapOpacity(), QWindowsCEStyle::drawPrimitive(), QWindowsVistaStyle::drawPrimitive(), QCommonStyle::drawPrimitive(), QWindowsMobileStyle::drawPrimitive(), QPlastiqueStyle::drawPrimitive(), QCleanlooksStyle::drawPrimitive(), QCDEStyle::drawPrimitive(), QWindowsXPStyle::drawPrimitive(), QWindowsStyle::drawPrimitive(), QGtkStyle::drawPrimitive(), QMotifStyle::drawPrimitive(), QMacStyle::drawPrimitive(), QX11PaintEngine::drawRects(), QVGPaintEngine::drawRects(), QOpenGLPaintEngine::drawRects(), QPaintEngine::drawRects(), QPaintEngineEx::drawRects(), QPainter::drawRects(), drawRects(), QTreeView::drawRow(), QWindowsMobileStylePrivate::drawScrollbarGrip(), drawTabBase(), drawTabShape(), QPainter::drawText(), QDirectFBPaintEnginePrivate::drawTiledPixmap(), QVistaHelper::drawTitleBar(), QVistaHelper::drawTitleText(), drawVGImage(), QWindowsCEStylePrivate::drawWinCEButton(), QWindowsCEStylePrivate::drawWinCEPanel(), effectiveState(), elliditide(), QPSPrintEnginePrivate::emitHeader(), QPicturePaintEngine::end(), QOutlineMapper::endOutline(), QPlainTextEditPrivate::ensureCursorVisible(), QScrollArea::ensureWidgetVisible(), QMdiSubWindowPrivate::enterRubberBandMode(), QVGCompositionHelper::fillBackground(), fillBackgroundRect(), QBlitterPaintEngine::fillRect(), QDirectFBPaintEngine::fillRect(), fillRect_normalized(), fillRects(), QVGPaintEngine::fillRegion(), QOpenGLPaintEnginePrivate::fillVertexArray(), QIconModeViewBase::filterDropEvent(), QMdi::MinOverlapPlacer::findMaxOverlappers(), QToolBarAreaLayout::fitLayout(), QDockAreaLayout::fitLayout(), QWindowsXPStylePrivate::fixAlphaChannel(), QListViewPrivate::flipX(), QCocoaWindowSurface::flush(), QX11GLWindowSurface::flush(), QWaylandShmWindowSurface::flush(), QMacWindowSurface::flush(), QX11WindowSurface::flush(), QGLWindowSurface::flush(), QRasterWindowSurface::flush(), QDockAreaLayout::gapIndex(), get_combo_parameters(), QDockAreaLayout::getGrid(), getNetWmState(), QX11GLWindowSurface::grabWidget(), QX11WindowSurface::grabWidget(), QWindowSurface::grabWidget(), QPixmap::grabWidget(), QVNCIntegration::grabWindow(), QWindowsXPStylePrivate::hasAlphaChannel(), QWindowsXPStylePrivate::hasAnyData(), QCommonListViewBase::horizontalScrollToValue(), QListModeViewBase::horizontalScrollToValue(), QColorPicker::huePt(), QDesktopWidgetPrivate::init(), QMacStylePrivate::initHIThemePushButton(), QClipData::initialize(), QTabBar::initStyleOption(), QGraphicsWidgetPrivate::initStyleOptionTitleBar(), QSpanData::initTexture(), QWorkspacePrivate::insertIcon(), QVGPaintEngine::isDefaultClipRect(), QVGPaintEngine::isDefaultClipRegion(), isEmptyHelper(), QRasterPaintEnginePrivate::isUnclipped(), Q3AccessibleTextEdit::itemRect(), QStyle::itemTextRect(), QMdiSubWindow::keyPressEvent(), QTabBarPrivate::layoutTabs(), QCoreGraphicsPaintEngine::macDisplayColorSpace(), make_widget_eventUPP(), make_win_eventUPP(), QMatrix::map(), QMatrix::mapRect(), QTransform::mapRect(), QMatrix4x4::mapRect(), QMatrix::mapToPolygon(), QTransform::mapToPolygon(), QListModeViewBase::mapToViewport(), QMenuBarPrivate::menuRect(), QtopiaPrintEngine::metric(), QPicture::metric(), QPdfBaseEngine::metric(), QCustomRasterPaintDevice::metric(), QWidget::metric(), QCalendarWidget::minimumSizeHint(), QVGPaintEnginePrivate::modifyMask(), QTabBar::mouseMoveEvent(), QSizeGrip::mousePressEvent(), QScrollBar::mousePressEvent(), QTabBar::mouseReleaseEvent(), PvrEglWindowSurface::move(), QListView::moveCursor(), QAccessibleWidget::navigate(), operator<<(), QMatrix4x4::ortho(), packRect(), QtopiaPrintEngine::pageRect(), QPdfBaseEnginePrivate::pageRect(), QDecorationStyled::paint(), QDecorationWindows::paint(), QDecorationDefault::paint(), QDeclarativePaintedItem::paint(), QColumnViewDelegate::paint(), QScriptDebuggerLocalsItemDelegate::paint(), QGtkPainter::paintArrow(), QScreen::paintBackground(), QGtkPainter::paintBox(), QGtkPainter::paintBoxGap(), QDecorationWindows::paintButton(), QGtkPainter::paintCheckbox(), QMdiSubWindow::paintEvent(), QLabel::paintEvent(), QWellArray::paintEvent(), QPagePreview::paintEvent(), QSystemTrayIconSys::paintEvent(), QWhatsThat::paintEvent(), QListView::paintEvent(), QLineEdit::paintEvent(), QPlainTextEdit::paintEvent(), QWorkspaceTitleBar::paintEvent(), QFileDialogComboBox::paintEvent(), QColorLuminancePicker::paintEvent(), QGtkPainter::paintExpander(), QGtkPainter::paintExtention(), QGtkPainter::paintFlatBox(), QGtkPainter::paintFocus(), QGtkPainter::paintHandle(), QGtkPainter::paintOption(), QGtkPainter::paintResizeGrip(), QHeaderView::paintSection(), QGtkPainter::paintShadow(), QGtkPainter::paintSlider(), QPdfBaseEnginePrivate::paperRect(), parseGeometry(), QPlatformScreen::physicalSize(), QSliderPrivate::pixelPosToRangeValue(), QScrollBarPrivate::pixelPosToRangeValue(), QTipLabel::placeTip(), QWidgetPrivate::pointToRect(), PolygonRegion(), QMenu::popup(), QMenuBarPrivate::popupAction(), QStyleSheetStyle::positionRect(), QBBWindow::post(), QRasterWindowSurface::prepareBuffer(), QGraphicsScenePrivate::processDirtyItemsRecursive(), QGLPixmapBlurFilter::processGL(), QGLPixmapDropShadowFilter::processGL(), QMacStylePrivate::pushButtonSizeFromContents(), QXcbShmImage::put(), QBBRootWindow::QBBRootWindow(), QCocoaScreen::QCocoaScreen(), QCocoaWindow::QCocoaWindow(), QCocoaWindowSurface::QCocoaWindowSurface(), qDrawBorderPixmap(), qDrawPlainRect(), qDrawShadePanel(), qDrawShadeRect(), qDrawWinButton(), qDrawWinPanel(), QLinuxFbScreen::QLinuxFbScreen(), qNormalizeRadii(), QPolygon::QPolygon(), QRectF::QRectF(), QRegion::QRegion(), QRegionPrivate::QRegionPrivate(), qstring_to_xtp(), QSvgImage::QSvgImage(), qt_add_rect(), qt_bitmapToRegion(), qt_cleanlooks_draw_buttongradient(), qt_grab_cursor(), qt_hirectForQRect(), qt_mac_clip_cg(), qt_mac_grabDisplayRect(), qt_mac_grabScreenRect(), qt_mac_post_retranslateAppMenu(), qt_mac_unregister_widget(), qt_mac_update_widget_position(), qt_plastique_draw_gradient(), qt_plastique_draw_handle(), qt_region_strictContains(), qt_scale_image_16bit(), qt_scale_image_32bit(), qt_tablet_cleanup_wce(), qt_transform_image_rasterize(), qt_wince_full_screen(), qt_x11_drawImage(), QtWndProc(), QGLMaskTextureCache::quadtreeInsert(), QVNCDirtyMap::QVNCDirtyMap(), QWhatsThat::QWhatsThat(), read_jpeg_image(), QMdi::RegularTiler::rearrange(), QMdi::SimpleCascader::rearrange(), QMdi::IconTiler::rearrange(), QAccessibleMenu::rect(), QAccessibleAbstractSpinBox::rect(), QAccessibleMenuBar::rect(), QAccessibleDoubleSpinBox::rect(), QAccessibleItemRow::rect(), QAccessibleScrollBar::rect(), QAccessibleSlider::rect(), QAccessibleDial::rect(), QAccessibleTabBar::rect(), QAccessibleMdiSubWindow::rect(), QAccessibleComboBox::rect(), QDecorationStyled::region(), QDecorationWindows::region(), QDecorationDefault::region(), QGraphicsView::render(), QWidgetPrivate::render_helper(), QGtkPainter::renderTheme(), QFbWindow::repaint(), QWidget::repaint(), QProgressBarPrivate::repaintRequired(), QScriptEdit::resizeEvent(), QWorkspaceChild::resizeEvent(), QBBScreen::resizeNativeWidgetWindow(), QMdiAreaPrivate::resizeToMinimumTileSize(), QBBScreen::resizeTopLevelWindow(), rotateTabPainter(), QAlphaWidget::run(), QDockAreaLayoutInfo::saveState(), QWhatsThisPrivate::say(), QDesktopWidget::screenNumber(), QX11GLWindowSurface::scroll(), QMacWindowSurface::scroll(), QX11WindowSurface::scroll(), QX11PixmapData::scroll(), QDirectFBWindowSurface::scroll(), QDirectFBPixmapData::scroll(), QGLWindowSurface::scroll(), QRasterWindowSurface::scroll(), QVGEGLWindowSurfaceDirect::scroll(), QWidgetPrivate::scroll_sys(), scrollSurface(), QDockAreaLayout::separatorRect(), QPolygonClipper< qt_float_point, qt_float_point, float >::setBoundingRect(), QClipData::setClipRect(), QPainter::setClipRegion(), QClipData::setClipRegion(), QUnixPrintWidgetPrivate::setCupsProperties(), PvrEglWindowSurface::setDirectRegion(), QIntfbScreen::setDirty(), QQnxScreen::setDirty(), QLinuxFbScreen::setDirty(), QWidget::setDisabled(), QLinuxFbScreen::setFormat(), QSplitterPrivate::setGeo(), QLinuxFbScreen::setGeometry(), QCocoaWindow::setGeometry(), QWaylandEglWindow::setGeometry(), QDirectFbWindow::setGeometry(), PvrEglWindowSurface::setGeometry(), QXcbWindow::setGeometry(), QOpenKODEWindow::setGeometry(), QBBWindow::setGeometry(), QX11GLWindowSurface::setGeometry(), QDirectFBWindowSurface::setGeometry(), QXlibWindow::setGeometry(), QRasterWindowSurface::setGeometry(), QBoxLayout::setGeometry(), QWidgetItem::setGeometry(), QFormLayout::setGeometry(), QDockWidgetLayout::setGeometry(), QMainWindowLayout::setGeometry(), QWidget::setGeometry(), QWidgetPrivate::setGeometry_sys(), QMdiSubWindowPrivate::setMaximizeMode(), QWidgetPrivate::setMinimumSize_helper(), QMdiSubWindowPrivate::setNewGeometry(), QDeclarativePaintedItem::setPixelCacheSize(), QBBScreen::setRotation(), QSplitter::setRubberBand(), QGL2PaintEngineExPrivate::setScissor(), QListView::setSelection(), QPageSetupWidget::setupPrinter(), QPainter::setViewport(), QPainter::setWindow(), setWindowGeometry(), QWidget::setWindowState(), QDeclarativeRectValueType::setY(), QCompleterPrivate::showPopup(), QComboBox::showPopup(), size(), QLabelPrivate::sizeForWidth(), QGtkStyle::sizeFromContents(), QStyleSheetStyle::sizeFromContents(), QMenuBar::sizeHint(), QMenu::sizeHint(), QWorkspaceTitleBar::sizeHint(), QMdiSubWindowPrivate::sizeParameters(), QAhiScreen::solidFill(), solidFill_template(), QWindowsXPStyle::styleHint(), QMacStyle::styleHint(), QCommonStyle::subControlRect(), QPlastiqueStyle::subControlRect(), QWindowsXPStyle::subControlRect(), QWindowsMobileStyle::subControlRect(), QCleanlooksStyle::subControlRect(), QMotifStyle::subControlRect(), QMacStyle::subControlRect(), QGtkStyle::subControlRect(), QStyleSheetStyle::subControlRect(), QCommonStyle::subElementRect(), QWindowsVistaStyle::subElementRect(), QWindowsCEStyle::subElementRect(), QMacStyle::subElementRect(), QMotifStyle::subElementRect(), QStyleSheetStyle::subElementRect(), QDirectFBScreen::surfaceForWidget(), QWindowsXPStylePrivate::swapAlphaChannel(), QEglContext::swapBuffersRegion2NOK(), QWidgetBackingStore::sync(), QCommonStylePrivate::tabLayout(), QWidget::testAttribute(), QItemDelegatePrivate::textLayoutBounds(), QItemDelegate::textRectangle(), QPlainTextEdit::timerEvent(), QTextEdit::timerEvent(), QRasterPixmapData::toImage(), QX11PixmapData::toImage(), XPThemeData::toRECT(), QTest::toString(), toVGImageSubRect(), QX11PixmapData::transformed(), QImage::transformed(), QETWidget::translateTabletEvent(), QApplicationPrivate::translateTouchEvent(), QETWidget::translateXinputEvent(), UnionRectWithRegion(), QWinInputContext::update(), QXIMInputContext::update(), QWidget::update(), QMenuPrivate::updateActionRects(), QPdfBaseEngine::updateClipPath(), QCalendarTextNavigator::updateDateLabel(), QOpenGLPaintEnginePrivate::updateDepthClip(), QStyledItemDelegate::updateEditorGeometry(), QTableView::updateGeometries(), QUIKitWindow::updateGeometryAndOrientation(), QRegionPrivate::updateInnerRect(), QComboBoxPrivate::updateLineEditGeometry(), QDeclarativeTextInput::updateRect(), updateRedirectedToGraphicsProxyWidget(), QMdiAreaPrivate::updateScrollBars(), useScrollBar(), QSettingsPrivate::variantToString(), QCommonStylePrivate::viewItemDrawText(), QCommonStylePrivate::viewItemLayout(), QCommonStylePrivate::viewItemSize(), QStyle::visualRect(), QPdfEnginePrivate::width(), and QRfbRawEncoder::write().

304 { return x2 - x1 + 1; }
int x2
Definition: qrect.h:180
int x1
Definition: qrect.h:178

◆ x()

int QRect::x ( ) const
inline

Returns the x-coordinate of the rectangle's left edge.

Equivalent to left().

See also
setX(), y(), topLeft()

Definition at line 252 of file qrect.h.

Referenced by QTextEditPrivate::_q_ensureVisible(), QLabelPrivate::_q_movieUpdated(), QWindowsAccessible::accLocation(), QLineEditPrivate::adjustedContentsRect(), QLineEditPrivate::adjustedControlRect(), QPushButtonPrivate::adjustedMenuPosition(), QWidgetPrivate::adjustedSize(), QDialog::adjustPosition(), QStyle::alignedRect(), QLayout::alignmentRect(), QApplicationPrivate::applyX11SpecificCommandLineArguments(), QFormLayoutPrivate::arrangeWidgets(), QBBScreen::availableGeometry(), QBalloonTip::balloon(), blendCursor(), QAhiScreen::blit(), QDirectFBPaintEnginePrivate::blit(), blit_template(), QVGCompositionHelper::blitWindow(), QRectF::bottom(), QPainter::boundingRect(), QVGPaintEngine::clearRect(), QPaintEngineEx::clip(), clipLine(), QListViewPrivate::closestIndex(), QScreen::compose(), QMacStylePrivate::contentFitsInPushButton(), QMacPixmapData::copy(), QDirectFBPixmapData::copy(), QX11PixmapData::copy(), QGLPixmapData::copy(), QImage::copy(), QBBWindow::copyBack(), QVolatileImage::copyFrom(), QWidgetPrivate::create_sys(), QDirectFBScreen::createDFBSurface(), QDirectFBScreen::createSurface(), QDirectFBWindowSurface::createWindow(), QWaylandWindow::damage(), QDeclarativePaintedItem::dirtyCache(), QGridLayoutPrivate::distribute(), do_size_hints(), QETWidget::doDeferredMap(), QXlibWindow::doSizeHints(), QVGPixmapConvolutionFilter::draw(), QVGPixmapColorizeFilter::draw(), QVGPixmapDropShadowFilter::draw(), QVGPixmapBlurFilter::draw(), QRenderRule::drawBackgroundImage(), QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(), QCommonStyle::drawComplexControl(), QWindowsCEStyle::drawComplexControl(), QWindowsMobileStyle::drawComplexControl(), QWindowsStyle::drawComplexControl(), QWindowsXPStyle::drawComplexControl(), QMotifStyle::drawComplexControl(), QStyleSheetStyle::drawComplexControl(), QMacStyle::drawComplexControl(), QCommonStyle::drawControl(), QWindowsCEStyle::drawControl(), QWindowsVistaStyle::drawControl(), QPlastiqueStyle::drawControl(), QWindowsMobileStyle::drawControl(), QCleanlooksStyle::drawControl(), QWindowsStyle::drawControl(), QGtkStyle::drawControl(), QMotifStyle::drawControl(), QMacStyle::drawControl(), QStyleSheetStyle::drawControl(), QStyleHelper::drawDial(), QX11PaintEngine::drawEllipse(), QPainter::drawEllipse(), drawEllipsePoints(), QX11PaintEngine::drawFreetype(), QRasterPaintEngine::drawImage(), QRasterPaintEnginePrivate::drawImage(), drawImageTiled(), QGraphicsScenePrivate::drawItemHelper(), QStyle::drawItemPixmap(), drawPixel(), drawPixelARGB32(), drawPixelARGB32Opaque(), QVGPaintEngine::drawPixmapFragments(), QDirectFbBlitter::drawPixmapOpacity(), QWindowsCEStyle::drawPrimitive(), QCommonStyle::drawPrimitive(), QWindowsVistaStyle::drawPrimitive(), QWindowsMobileStyle::drawPrimitive(), QPlastiqueStyle::drawPrimitive(), QCDEStyle::drawPrimitive(), QWindowsXPStyle::drawPrimitive(), QWindowsStyle::drawPrimitive(), QMotifStyle::drawPrimitive(), QMacStyle::drawPrimitive(), QX11PaintEngine::drawRects(), QVGPaintEngine::drawRects(), QOpenGLPaintEngine::drawRects(), QPaintEngine::drawRects(), QPaintEngineEx::drawRects(), drawRects(), QWindowsMobileStylePrivate::drawScrollbarGrip(), drawTabBase(), drawTabShape(), QPainter::drawText(), QDirectFBPaintEnginePrivate::drawTiledPixmap(), drawVGImage(), QWindowsCEStylePrivate::drawWinCEButton(), QWindowsCEStylePrivate::drawWinCEPanel(), QOutlineMapper::endOutline(), QAlphaWidget::eventFilter(), QQnxScreen::exposeRegion(), QDirectFBScreen::exposeRegion(), QScriptEdit::extraAreaPaintEvent(), QVGCompositionHelper::fillBackground(), fillBackgroundRect(), QX11PaintEnginePrivate::fillPolygon_dev(), QBlitterPaintEngine::fillRect(), QDirectFBPaintEngine::fillRect(), fillRect_normalized(), fillRects(), QVGPaintEngine::fillRegion(), QDirectFBScreen::flipSurface(), QListViewPrivate::flipX(), QDirectFbWindowSurface::flush(), QCocoaWindowSurface::flush(), QX11GLWindowSurface::flush(), QWaylandShmWindowSurface::flush(), QMacWindowSurface::flush(), QX11WindowSurface::flush(), QGLWindowSurface::flush(), QRasterWindowSurface::flush(), get_combo_parameters(), QX11GLWindowSurface::grabWidget(), QX11WindowSurface::grabWidget(), QWindowSurface::grabWidget(), QPixmap::grabWidget(), QXcbWindow::handleConfigureNotifyEvent(), QIconModeViewBase::initDynamicLayout(), QClipData::initialize(), QSpanData::initTexture(), QWidgetPrivate::invalidateBuffer_resizeHelper(), QVGPaintEngine::isDefaultClipRect(), QVGPaintEngine::isDefaultClipRegion(), isServerProcess(), QRasterPaintEnginePrivate::isUnclipped(), Q3AccessibleTextEdit::itemRect(), QMdiSubWindow::keyPressEvent(), QCoreGraphicsPaintEngine::macDisplayColorSpace(), make_widget_eventUPP(), make_win_eventUPP(), QMatrix::map(), QTransformedScreen::mapFromDevice(), QMatrix::mapRect(), QTransform::mapRect(), QMatrix4x4::mapRect(), QTransformedScreen::mapToDevice(), QMatrix::mapToPolygon(), QTransform::mapToPolygon(), QVGPaintEnginePrivate::modifyMask(), QWidgetResizeHandler::mouseMoveEvent(), QTabBar::mouseMoveEvent(), QSizeGrip::mousePressEvent(), QScrollBar::mousePressEvent(), PvrEglWindowSurface::move(), QWidget::move(), QAbstractButtonPrivate::moveFocus(), QMacPrintEnginePrivate::newPage_helper(), QBBWindow::offset(), operator<<(), operator>>(), QMatrix4x4::ortho(), packRect(), QDecorationStyled::paint(), QDecorationWindows::paint(), QDecorationDefault::paint(), QDeclarativePaintedItem::paint(), QFontFamilyDelegate::paint(), QDeclarativeText::paint(), QColumnViewDelegate::paint(), QGtkPainter::paintArrow(), QScreen::paintBackground(), QDecorationWindows::paintButton(), QDecorationDefault::paintButton(), QGtkPainter::paintCheckbox(), QLabel::paintEvent(), QWellArray::paintEvent(), QSystemTrayIconSys::paintEvent(), QPagePreview::paintEvent(), QTabWidget::paintEvent(), QWhatsThat::paintEvent(), QTabBar::paintEvent(), QLineEdit::paintEvent(), QGtkPainter::paintOption(), parseGeometry(), QSliderPrivate::pixelPosToRangeValue(), QScrollBarPrivate::pixelPosToRangeValue(), QGraphicsItemEffectSourcePrivate::pixmap(), QTipLabel::placeTip(), QMenu::popup(), QMenuBarPrivate::popupAction(), QToolButtonPrivate::popupTimerDone(), QBBWindow::post(), QRasterWindowSurface::prepareBuffer(), QGraphicsScenePrivate::processDirtyItemsRecursive(), QMacPrintEngine::property(), QXcbShmImage::put(), q_createNativeChildrenAndSetParent(), QCocoaWindow::QCocoaWindow(), QCocoaWindowSurface::QCocoaWindowSurface(), qDrawPlainRect(), qDrawShadePanel(), qDrawShadeRect(), qDrawWinButton(), qDrawWinPanel(), QPolygon::QPolygon(), QRegion::QRegion(), qstring_to_xtp(), qt_add_rect(), qt_bitmapToRegion(), qt_grab_cursor(), qt_hirectForQRect(), qt_mac_clip_cg(), qt_mac_get_widget_rgn(), qt_mac_grabDisplayRect(), qt_mac_grabScreenRect(), qt_mac_post_retranslateAppMenu(), qt_mac_unregister_widget(), qt_mac_update_widget_position(), qt_scale_image_16bit(), qt_scale_image_32bit(), qt_show_system_menu(), qt_tablet_cleanup_wce(), qt_x11_drawImage(), QtWndProc(), QVNCDirtyMap::QVNCDirtyMap(), QVNCScreenPrivate::QVNCScreenPrivate(), read_jpeg_image(), QAccessibleMenu::rect(), QAccessibleAbstractSpinBox::rect(), QAccessibleMenuBar::rect(), QAccessibleToolButton::rect(), QAccessibleDoubleSpinBox::rect(), QAccessibleScrollBar::rect(), QAccessibleSlider::rect(), QAccessibleDial::rect(), QAccessibleTabBar::rect(), QAccessibleMdiSubWindow::rect(), QAccessibleComboBox::rect(), QDecorationStyled::region(), QXlibWindow::resizeEvent(), QWorkspaceChild::resizeEvent(), QBBScreen::resizeTopLevelWindow(), QAlphaWidget::run(), QRollEffect::run(), QDockAreaLayoutInfo::saveState(), QWhatsThisPrivate::say(), QX11GLWindowSurface::scroll(), QMacWindowSurface::scroll(), QX11WindowSurface::scroll(), QDirectFBWindowSurface::scroll(), QDirectFBPixmapData::scroll(), QGLWindowSurface::scroll(), QRasterWindowSurface::scroll(), QVGEGLWindowSurfaceDirect::scroll(), QRollEffect::scroll(), QWidgetPrivate::scroll_sys(), scrollSurface(), QAccessibleTextEdit::scrollToSubstring(), QPageSetupWidget::selectPrinter(), QPolygonClipper< qt_float_point, qt_float_point, float >::setBoundingRect(), QClipData::setClipRect(), QPainter::setClipRegion(), QClipData::setClipRegion(), PvrEglWindowSurface::setDirectRegion(), QIntfbScreen::setDirty(), QQnxScreen::setDirty(), QVNCScreenPrivate::setDirty(), QWidget::setDisabled(), QSplitterPrivate::setGeo(), QCocoaWindow::setGeometry(), QDirectFbWindow::setGeometry(), PvrEglWindowSurface::setGeometry(), QXcbWindow::setGeometry(), QOpenKODEWindow::setGeometry(), QBBWindow::setGeometry(), QDirectFBWindowSurface::setGeometry(), QXlibWindow::setGeometry(), QBoxLayout::setGeometry(), QWidgetItem::setGeometry(), QWidget::setGeometry(), QWidgetPrivate::setGeometry_sys(), QMdiSubWindowPrivate::setNewGeometry(), QSplitter::setRubberBand(), QDeclarativeRectValueType::setValue(), QPainter::setViewport(), QDirectFbWindow::setVisible(), QPainter::setWindow(), setWindowGeometry(), QVistaHelper::setWindowPosHack(), QWidget::setWindowState(), QCompleterPrivate::showPopup(), QComboBox::showPopup(), QMenuBar::sizeHint(), QMenu::sizeHint(), QAhiScreen::solidFill(), solidFill_template(), QMacStyle::styleHint(), QMacStyle::subControlRect(), QStyleSheetStyle::subControlRect(), QCommonStyle::subElementRect(), QWindowsVistaStyle::subElementRect(), QMacStyle::subElementRect(), QDirectFBScreen::surfaceForWidget(), QEglContext::swapBuffersRegion2NOK(), QWidget::testAttribute(), QRasterPixmapData::toImage(), QX11PixmapData::toImage(), XPThemeData::toRECT(), toVGImageSubRect(), QETWidget::translateXinputEvent(), QWinInputContext::update(), QXIMInputContext::update(), QDirectFBPaintEnginePrivate::updateClip(), QUIKitWindow::updateGeometryAndOrientation(), QDeclarativeTextInput::updateRect(), updateRedirectedToGraphicsProxyWidget(), QScrollAreaPrivate::updateWidgetPosition(), QSettingsPrivate::variantToString(), QRfbRawEncoder::write(), QDeclarativeTextInputPrivate::xToPos(), and QLineEditPrivate::xToPos().

253 { return x1; }
int x1
Definition: qrect.h:178

◆ y()

int QRect::y ( ) const
inline

Returns the y-coordinate of the rectangle's top edge.

Equivalent to top().

See also
setY(), x(), topLeft()

Definition at line 255 of file qrect.h.

Referenced by QTextEditPrivate::_q_ensureVisible(), QLabelPrivate::_q_movieUpdated(), QWindowsAccessible::accLocation(), QLineEditPrivate::adjustedContentsRect(), QPushButtonPrivate::adjustedMenuPosition(), QWidgetPrivate::adjustedSize(), QDialog::adjustPosition(), QStyle::alignedRect(), QLayout::alignmentRect(), QApplicationPrivate::applyX11SpecificCommandLineArguments(), QBBScreen::availableGeometry(), blendCursor(), QAhiScreen::blit(), QDirectFBPaintEnginePrivate::blit(), blit_template(), QVGCompositionHelper::blitWindow(), QRectF::bottom(), QPainter::boundingRect(), canMergeFromBelow(), QRegionPrivate::canPrepend(), QVGPaintEngine::clearRect(), QPaintEngineEx::clip(), clipLine(), QListViewPrivate::closestIndex(), QScreen::compose(), QMacStylePrivate::contentFitsInPushButton(), QMacPixmapData::copy(), QDirectFBPixmapData::copy(), QX11PixmapData::copy(), QGLPixmapData::copy(), QImage::copy(), QBBWindow::copyBack(), QVolatileImage::copyFrom(), QWidgetPrivate::create_sys(), QDirectFBScreen::createDFBSurface(), QDirectFBScreen::createSurface(), QDirectFBWindowSurface::createWindow(), QWaylandWindow::damage(), QDeclarativePaintedItem::dirtyCache(), QGridLayoutPrivate::distribute(), do_size_hints(), QETWidget::doDeferredMap(), QXlibWindow::doSizeHints(), QVGPixmapConvolutionFilter::draw(), QVGPixmapColorizeFilter::draw(), QVGPixmapDropShadowFilter::draw(), QVGPixmapBlurFilter::draw(), QRenderRule::drawBackgroundImage(), QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(), QCommonStyle::drawComplexControl(), QWindowsCEStyle::drawComplexControl(), QWindowsMobileStyle::drawComplexControl(), QWindowsStyle::drawComplexControl(), QWindowsXPStyle::drawComplexControl(), QMotifStyle::drawComplexControl(), QStyleSheetStyle::drawComplexControl(), QMacStyle::drawComplexControl(), QCommonStyle::drawControl(), QWindowsCEStyle::drawControl(), QPlastiqueStyle::drawControl(), QWindowsMobileStyle::drawControl(), QCleanlooksStyle::drawControl(), QWindowsStyle::drawControl(), QGtkStyle::drawControl(), QMotifStyle::drawControl(), QMacStyle::drawControl(), QStyleSheetStyle::drawControl(), QStyleHelper::drawDial(), QX11PaintEngine::drawEllipse(), QPainter::drawEllipse(), drawEllipsePoints(), QX11PaintEngine::drawFreetype(), QRasterPaintEngine::drawImage(), QRasterPaintEnginePrivate::drawImage(), drawImageTiled(), QGraphicsScenePrivate::drawItemHelper(), QStyle::drawItemPixmap(), drawPixel(), drawPixelARGB32(), drawPixelARGB32Opaque(), QVGPaintEngine::drawPixmapFragments(), QDirectFbBlitter::drawPixmapOpacity(), QWindowsCEStyle::drawPrimitive(), QCommonStyle::drawPrimitive(), QWindowsVistaStyle::drawPrimitive(), QWindowsMobileStyle::drawPrimitive(), QPlastiqueStyle::drawPrimitive(), QCDEStyle::drawPrimitive(), QWindowsXPStyle::drawPrimitive(), QWindowsStyle::drawPrimitive(), QMotifStyle::drawPrimitive(), QMacStyle::drawPrimitive(), QX11PaintEngine::drawRects(), QVGPaintEngine::drawRects(), QOpenGLPaintEngine::drawRects(), QPaintEngine::drawRects(), QPaintEngineEx::drawRects(), QPainter::drawRects(), drawRects(), QTreeView::drawRow(), QWindowsMobileStylePrivate::drawScrollbarGrip(), drawTabShape(), QPainter::drawText(), QDirectFBPaintEnginePrivate::drawTiledPixmap(), QTreeView::drawTree(), drawVGImage(), QWindowsCEStylePrivate::drawWinCEButton(), QWindowsCEStylePrivate::drawWinCEPanel(), QOutlineMapper::endOutline(), QAlphaWidget::eventFilter(), QQnxScreen::exposeRegion(), QDirectFBScreen::exposeRegion(), QScriptEdit::extraAreaPaintEvent(), QVGCompositionHelper::fillBackground(), fillBackgroundRect(), QX11PaintEnginePrivate::fillPolygon_dev(), QBlitterPaintEngine::fillRect(), QDirectFBPaintEngine::fillRect(), fillRect_normalized(), fillRects(), QVGPaintEngine::fillRegion(), QSystemTrayIconSys::findTrayGeometry(), flipedRect(), QDirectFBScreen::flipSurface(), QListViewPrivate::flipX(), QDirectFbWindowSurface::flush(), QCocoaWindowSurface::flush(), QX11GLWindowSurface::flush(), QWaylandShmWindowSurface::flush(), QMacWindowSurface::flush(), QX11WindowSurface::flush(), QGLWindowSurface::flush(), QRasterWindowSurface::flush(), get_combo_parameters(), QX11GLWindowSurface::grabWidget(), QX11WindowSurface::grabWidget(), QWindowSurface::grabWidget(), QPixmap::grabWidget(), QXcbWindow::handleConfigureNotifyEvent(), QIconModeViewBase::initDynamicLayout(), QClipData::initialize(), QSpanData::initTexture(), QRegionPrivate::intersect(), QVGPaintEngine::isDefaultClipRect(), QVGPaintEngine::isDefaultClipRegion(), isServerProcess(), QRasterPaintEnginePrivate::isUnclipped(), Q3AccessibleTextEdit::itemRect(), QMdiSubWindow::keyPressEvent(), QCoreGraphicsPaintEngine::macDisplayColorSpace(), make_widget_eventUPP(), make_win_eventUPP(), QMatrix::map(), QTransformedScreen::mapFromDevice(), QMatrix::mapRect(), QTransform::mapRect(), QMatrix4x4::mapRect(), QTransformedScreen::mapToDevice(), QMatrix::mapToPolygon(), QTransform::mapToPolygon(), QVGPaintEnginePrivate::modifyMask(), QWidgetResizeHandler::mouseMoveEvent(), QTabBar::mouseMoveEvent(), QSizeGrip::mousePressEvent(), QScrollBar::mousePressEvent(), PvrEglWindowSurface::move(), QWidget::move(), QAbstractButtonPrivate::moveFocus(), QMacPrintEnginePrivate::newPage_helper(), QBBWindow::offset(), operator<<(), operator>>(), QMatrix4x4::ortho(), packRect(), QDecorationWindows::paint(), QDecorationDefault::paint(), QDeclarativePaintedItem::paint(), QFontFamilyDelegate::paint(), QDeclarativeText::paint(), QColumnViewDelegate::paint(), QGtkPainter::paintArrow(), QScreen::paintBackground(), QDecorationWindows::paintButton(), QDecorationDefault::paintButton(), QGtkPainter::paintCheckbox(), QLabel::paintEvent(), QWellArray::paintEvent(), QSystemTrayIconSys::paintEvent(), QPagePreview::paintEvent(), QTabWidget::paintEvent(), QWhatsThat::paintEvent(), QTabBar::paintEvent(), QLineEdit::paintEvent(), QGtkPainter::paintOption(), parseGeometry(), QSliderPrivate::pixelPosToRangeValue(), QScrollBarPrivate::pixelPosToRangeValue(), QGraphicsItemEffectSourcePrivate::pixmap(), QTipLabel::placeTip(), QMenu::popup(), QMenuBarPrivate::popupAction(), QBBWindow::post(), QRasterWindowSurface::prepareBuffer(), QGraphicsScenePrivate::processDirtyItemsRecursive(), QMacPrintEngine::property(), QXcbShmImage::put(), q_createNativeChildrenAndSetParent(), QCocoaWindow::QCocoaWindow(), QCocoaWindowSurface::QCocoaWindowSurface(), qDrawPlainRect(), qDrawShadePanel(), qDrawShadeRect(), qDrawWinButton(), qDrawWinPanel(), QPolygon::QPolygon(), QRegion::QRegion(), qstring_to_xtp(), qt_add_rect(), qt_bitmapToRegion(), qt_grab_cursor(), qt_hirectForQRect(), qt_mac_clip_cg(), qt_mac_get_widget_rgn(), qt_mac_grabDisplayRect(), qt_mac_grabScreenRect(), qt_mac_post_retranslateAppMenu(), qt_mac_unregister_widget(), qt_mac_update_widget_position(), qt_regionToPath(), qt_scale_image_16bit(), qt_scale_image_32bit(), qt_show_system_menu(), qt_tablet_cleanup_wce(), qt_x11_drawImage(), QtWndProc(), QVNCDirtyMap::QVNCDirtyMap(), QVNCScreenPrivate::QVNCScreenPrivate(), QWorkspaceChild::QWorkspaceChild(), read_jpeg_image(), QAccessibleMenu::rect(), QAccessibleAbstractSpinBox::rect(), QAccessibleMenuBar::rect(), QAccessibleDoubleSpinBox::rect(), QAccessibleScrollBar::rect(), QAccessibleSlider::rect(), QAccessibleDial::rect(), QAccessibleTabBar::rect(), QAccessibleMdiSubWindow::rect(), QAccessibleComboBox::rect(), QXlibWindow::resizeEvent(), QWorkspaceChild::resizeEvent(), QBBScreen::resizeTopLevelWindow(), rotateTabPainter(), QAlphaWidget::run(), QRollEffect::run(), QDockAreaLayoutInfo::saveState(), QWhatsThisPrivate::say(), QX11GLWindowSurface::scroll(), QMacWindowSurface::scroll(), QX11WindowSurface::scroll(), QDirectFBWindowSurface::scroll(), QDirectFBPixmapData::scroll(), QGLWindowSurface::scroll(), QRasterWindowSurface::scroll(), QVGEGLWindowSurfaceDirect::scroll(), QRollEffect::scroll(), QWidgetPrivate::scroll_sys(), scrollSurface(), QAccessibleTextEdit::scrollToSubstring(), QPageSetupWidget::selectPrinter(), QPolygonClipper< qt_float_point, qt_float_point, float >::setBoundingRect(), QClipData::setClipRect(), QPainter::setClipRegion(), QClipData::setClipRegion(), PvrEglWindowSurface::setDirectRegion(), QIntfbScreen::setDirty(), QQnxScreen::setDirty(), QVNCScreenPrivate::setDirty(), QWidget::setDisabled(), QSplitterPrivate::setGeo(), QCocoaWindow::setGeometry(), QDirectFbWindow::setGeometry(), PvrEglWindowSurface::setGeometry(), QOpenKODEWindow::setGeometry(), QXcbWindow::setGeometry(), QBBWindow::setGeometry(), QDirectFBWindowSurface::setGeometry(), QXlibWindow::setGeometry(), QBoxLayout::setGeometry(), QWidgetItem::setGeometry(), QFormLayout::setGeometry(), QWidget::setGeometry(), QAbstractItemViewPrivate::setHoverIndex(), QMdiSubWindowPrivate::setNewGeometry(), QSplitter::setRubberBand(), QDeclarativeRectValueType::setValue(), QPainter::setViewport(), QDirectFbWindow::setVisible(), QPainter::setWindow(), setWindowGeometry(), QVistaHelper::setWindowPosHack(), QWidget::setWindowState(), QComboBox::showPopup(), QMenuBar::sizeHint(), QMenu::sizeHint(), QAhiScreen::solidFill(), solidFill_template(), QMacStyle::styleHint(), QMacStyle::subControlRect(), QStyleSheetStyle::subControlRect(), QCommonStyle::subElementRect(), QWindowsVistaStyle::subElementRect(), QMacStyle::subElementRect(), QStyleSheetStyle::subElementRect(), QDirectFBScreen::surfaceForWidget(), QEglContext::swapBuffersRegion2NOK(), QWidget::testAttribute(), QRasterPixmapData::toImage(), QX11PixmapData::toImage(), XPThemeData::toRECT(), toVGImageSubRect(), QETWidget::translateXinputEvent(), QWinInputContext::update(), QXIMInputContext::update(), QDirectFBPaintEnginePrivate::updateClip(), QScriptEdit::updateExtraArea(), QUIKitWindow::updateGeometryAndOrientation(), QDeclarativeTextEdit::updateImgCache(), QDeclarativeTextInput::updateRect(), updateRedirectedToGraphicsProxyWidget(), QScrollAreaPrivate::updateWidgetPosition(), QSettingsPrivate::variantToString(), and QRfbRawEncoder::write().

256 { return y1; }
int y1
Definition: qrect.h:177

Friends and Related Functions

◆ operator!=

bool operator!= ( const QRect r1,
const QRect r2 
)
friend

Returns true if the rectangles r1 and r2 are different, otherwise returns false.

Definition at line 501 of file qrect.h.

Referenced by QRectF::bottomLeft().

502 {
503  return r1.x1!=r2.x1 || r1.x2!=r2.x2 || r1.y1!=r2.y1 || r1.y2!=r2.y2;
504 }
int y1
Definition: qrect.h:177
int y2
Definition: qrect.h:179
int x2
Definition: qrect.h:180
int x1
Definition: qrect.h:178

◆ operator<<()

QDataStream & operator<< ( QDataStream stream,
const QRect rectangle 
)
related

Writes the given rectangle to the given stream, and returns a reference to the stream.

See also
{Serializing Qt Data Types}

Definition at line 1512 of file qrect.cpp.

Referenced by operator!=().

1513 {
1514  if (s.version() == 1)
1515  s << (qint16)r.left() << (qint16)r.top()
1516  << (qint16)r.right() << (qint16)r.bottom();
1517  else
1518  s << (qint32)r.left() << (qint32)r.top()
1519  << (qint32)r.right() << (qint32)r.bottom();
1520  return s;
1521 }
int qint32
Definition: qglobal.h:937
short qint16
Definition: qglobal.h:935

◆ operator==

bool operator== ( const QRect r1,
const QRect r2 
)
friend

Returns true if the rectangles r1 and r2 are equal, otherwise returns false.

Definition at line 496 of file qrect.h.

Referenced by QRectF::bottomLeft().

497 {
498  return r1.x1==r2.x1 && r1.x2==r2.x2 && r1.y1==r2.y1 && r1.y2==r2.y2;
499 }
int y1
Definition: qrect.h:177
int y2
Definition: qrect.h:179
int x2
Definition: qrect.h:180
int x1
Definition: qrect.h:178

◆ operator>>()

QDataStream & operator>> ( QDataStream stream,
QRect rectangle 
)
related

Reads a rectangle from the given stream into the given rectangle, and returns a reference to the stream.

See also
{Serializing Qt Data Types}

Definition at line 1536 of file qrect.cpp.

1537 {
1538  if (s.version() == 1) {
1539  qint16 x1, y1, x2, y2;
1540  s >> x1; s >> y1; s >> x2; s >> y2;
1541  r.setCoords(x1, y1, x2, y2);
1542  }
1543  else {
1544  qint32 x1, y1, x2, y2;
1545  s >> x1; s >> y1; s >> x2; s >> y2;
1546  r.setCoords(x1, y1, x2, y2);
1547  }
1548  return s;
1549 }
int qint32
Definition: qglobal.h:937
int y1
Definition: qrect.h:177
int y2
Definition: qrect.h:179
short qint16
Definition: qglobal.h:935
int x2
Definition: qrect.h:180
int x1
Definition: qrect.h:178

◆ qt_setCoords

void qt_setCoords ( QRect r,
int  xp1,
int  yp1,
int  xp2,
int  yp2 
)
friend

Properties

◆ x1

int QRect::x1
private

◆ x2

int QRect::x2
private

◆ y1

int QRect::y1
private

◆ y2

int QRect::y2
private

The documentation for this class was generated from the following files: