Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QRegion Class Reference

The QRegion class specifies a clip region for a painter. More...

#include <qregion.h>

+ Collaboration diagram for QRegion:

Public Types

enum  RegionType { Rectangle , Ellipse }
 Specifies the shape of the region to be created. More...
 
typedef const QRectconst_iterator
 
typedef std::reverse_iterator< const_iteratorconst_reverse_iterator
 

Public Member Functions

 QRegion ()
 Constructs an empty region.
 
 QRegion (int x, int y, int w, int h, RegionType t=Rectangle)
 Constructs a rectangular or elliptic region.
 
 QRegion (const QRect &r, RegionType t=Rectangle)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Create a region based on the rectangle r with region type t.
 
 QRegion (const QPolygon &pa, Qt::FillRule fillRule=Qt::OddEvenFill)
 Constructs a polygon region from the point array a with the fill rule specified by fillRule.
 
 QRegion (const QRegion &region)
 Constructs a new region which is equal to region r.
 
 QRegion (QRegion &&other) noexcept
 
 QRegion (const QBitmap &bitmap)
 Constructs a region from the bitmap bm.
 
 ~QRegion ()
 
QRegionoperator= (const QRegion &)
 Assigns r to this region and returns a reference to the region.
 
void swap (QRegion &other) noexcept
 
bool isEmpty () const
 Returns true if the region is empty; otherwise returns false.
 
bool isNull () const
 
const_iterator begin () const noexcept
 
const_iterator cbegin () const noexcept
 
const_iterator end () const noexcept
 
const_iterator cend () const noexcept
 
const_reverse_iterator rbegin () const noexcept
 
const_reverse_iterator crbegin () const noexcept
 
const_reverse_iterator rend () const noexcept
 
const_reverse_iterator crend () const noexcept
 
bool contains (const QPoint &p) const
 Returns true if the region contains the point p; otherwise returns false.
 
bool contains (const QRect &r) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns true if the region overlaps the rectangle r; otherwise returns false.
 
void translate (int dx, int dy)
 Translates (moves) the region dx along the X axis and dy along the Y axis.
 
void translate (const QPoint &p)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Translates the region {point}{.x()} along the x axis and {point}{.y()} along the y axis, relative to the current position.
 
QRegion translated (int dx, int dy) const
 
QRegion translated (const QPoint &p) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
QRegion united (const QRegion &r) const
 
QRegion united (const QRect &r) const
 
QRegion intersected (const QRegion &r) const
 
QRegion intersected (const QRect &r) const
 
QRegion subtracted (const QRegion &r) const
 
QRegion xored (const QRegion &r) const
 
bool intersects (const QRegion &r) const
 
bool intersects (const QRect &r) const
 
QRect boundingRect () const noexcept
 Returns the bounding rectangle of this region.
 
void setRects (const QRect *rect, int num)
 Sets the region using the array of rectangles specified by rects and number.
 
int rectCount () const noexcept
 
QRegion operator| (const QRegion &r) const
 Applies the united() function to this region and r.
 
QRegion operator+ (const QRegion &r) const
 Applies the united() function to this region and r.
 
QRegion operator+ (const QRect &r) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
QRegion operator& (const QRegion &r) const
 Applies the intersected() function to this region and r.
 
QRegion operator& (const QRect &r) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
QRegion operator- (const QRegion &r) const
 Applies the subtracted() function to this region and r.
 
QRegion operator^ (const QRegion &r) const
 Applies the xored() function to this region and r.
 
QRegionoperator|= (const QRegion &r)
 Applies the united() function to this region and r and assigns the result to this region.
 
QRegionoperator+= (const QRegion &r)
 Applies the united() function to this region and r and assigns the result to this region.
 
QRegionoperator+= (const QRect &r)
 Returns a region that is the union of this region with the specified rect.
 
QRegionoperator&= (const QRegion &r)
 Applies the intersected() function to this region and r and assigns the result to this region.
 
QRegionoperator&= (const QRect &r)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
QRegionoperator-= (const QRegion &r)
 Applies the subtracted() function to this region and r and assigns the result to this region.
 
QRegionoperator^= (const QRegion &r)
 Applies the xored() function to this region and r and assigns the result to this region.
 
bool operator== (const QRegion &r) const
 Returns true if the region is equal to r; otherwise returns false.
 
bool operator!= (const QRegion &r) const
 Returns true if this region is different from the other region; otherwise returns false.
 
 operator QVariant () const
 Returns the region as a QVariant.
 

Friends

struct QRegionPrivate
 
Q_GUI_EXPORT QDataStreamoperator<< (QDataStream &, const QRegion &)
 Writes the region r to the stream s and returns a reference to the stream.
 
Q_GUI_EXPORT QDataStreamoperator>> (QDataStream &, QRegion &)
 Reads a region from the stream s into r and returns a reference to the stream.
 
Q_GUI_EXPORT friend bool qt_region_strictContains (const QRegion &region, const QRect &rect)
 

Related Symbols

(Note that these are not member symbols.)

QDataStreamoperator<< (QDataStream &s, const QRegion &r)
 Writes the region r to the stream s and returns a reference to the stream.
 
QDataStreamoperator>> (QDataStream &s, QRegion &r)
 Reads a region from the stream s into r and returns a reference to the stream.
 

Detailed Description

The QRegion class specifies a clip region for a painter.

\inmodule QtGui

QRegion is used with QPainter::setClipRegion() to limit the paint area to what needs to be painted. There is also a QWidget::repaint() function that takes a QRegion parameter. QRegion is the best tool for minimizing the amount of screen area to be updated by a repaint.

This class is not suitable for constructing shapes for rendering, especially as outlines. Use QPainterPath to create paths and shapes for use with QPainter.

QRegion is an \l{implicitly shared} class.

Definition at line 26 of file qregion.h.

Member Typedef Documentation

◆ const_iterator

Since
5.8

An iterator over the non-overlapping rectangles that make up the region.

The union of all the rectangles is equal to the original region.

QRegion does not offer mutable iterators.

See also
begin(), end()

Definition at line 46 of file qregion.h.

◆ const_reverse_iterator

Since
5.8

A reverse iterator over the non-overlapping rectangles that make up the region.

The union of all the rectangles is equal to the original region.

QRegion does not offer mutable iterators.

See also
rbegin(), rend()

Definition at line 47 of file qregion.h.

Member Enumeration Documentation

◆ RegionType

Specifies the shape of the region to be created.

\value Rectangle the region covers the entire rectangle. \value Ellipse the region is an ellipse inside the rectangle.

Enumerator
Rectangle 
Ellipse 

Definition at line 29 of file qregion.h.

Constructor & Destructor Documentation

◆ QRegion() [1/7]

QRegion::QRegion ( )

Constructs an empty region.

See also
isEmpty()

Referenced by operator&=(), and operator+=().

+ Here is the caller graph for this function:

◆ QRegion() [2/7]

QRegion::QRegion ( int x,
int y,
int w,
int h,
RegionType t = Rectangle )

Constructs a rectangular or elliptic region.

If t is Rectangle, the region is the filled rectangle (x, y, w, h). If t is Ellipse, the region is the filled ellipse with center at (x + w / 2, y + h / 2) and size (w ,h).

Definition at line 160 of file qregion.cpp.

◆ QRegion() [3/7]

QRegion::QRegion ( const QRect & r,
RegionType t = Rectangle )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Create a region based on the rectangle r with region type t.

If the rectangle is invalid a null region will be created.

See also
QRegion::RegionType

◆ QRegion() [4/7]

QRegion::QRegion ( const QPolygon & a,
Qt::FillRule fillRule = Qt::OddEvenFill )

Constructs a polygon region from the point array a with the fill rule specified by fillRule.

If fillRule is \l{Qt::WindingFill}, the polygon region is defined using the winding algorithm; if it is \l{Qt::OddEvenFill}, the odd-even fill algorithm is used.

Warning
This constructor can be used to create complex regions that will slow down painting when used.

◆ QRegion() [5/7]

QRegion::QRegion ( const QRegion & region)

Constructs a new region which is equal to region r.

◆ QRegion() [6/7]

QRegion::QRegion ( QRegion && other)
inlinenoexcept
Since
5.7

Move-constructs a new region from region other. After the call, other is null.

See also
isNull()

Definition at line 36 of file qregion.h.

◆ QRegion() [7/7]

QRegion::QRegion ( const QBitmap & bm)

Constructs a region from the bitmap bm.

The resulting region consists of the pixels in bitmap bm that are Qt::color1, as if each pixel was a 1 by 1 rectangle.

This constructor may create complex regions that will slow down painting when used. Note that drawing masked pixmaps can be done much faster using QPixmap::setMask().

◆ ~QRegion()

QRegion::~QRegion ( )

Destroys the region.

Member Function Documentation

◆ begin()

QRegion::begin ( ) const
noexcept
Since
5.8

Returns a const_iterator pointing to the beginning of the range of non-overlapping rectangles that make up the region.

The union of all the rectangles is equal to the original region.

See also
rbegin(), cbegin(), end()

Referenced by QPaintEngineEx::clip(), QXcbBackingStore::endPaint(), QClipData::initialize(), qRegionToWinRegion(), qt_regionToPath(), QTest::toString(), and QSGSoftwareRenderableNode::update().

+ Here is the caller graph for this function:

◆ boundingRect()

◆ cbegin()

QRegion::cbegin ( ) const
inlinenoexcept
Since
5.8

Same as begin().

Definition at line 50 of file qregion.h.

References begin().

+ Here is the call graph for this function:

◆ cend()

QRegion::cend ( ) const
inlinenoexcept
Since
5.8

Same as end().

Definition at line 52 of file qregion.h.

◆ contains() [1/2]

bool QRegion::contains ( const QPoint & p) const

Returns true if the region contains the point p; otherwise returns false.

Referenced by QSGAbstractSoftwareRenderer::optimizeRenderList(), QDockAreaLayoutInfo::paintSeparators(), and QDockAreaLayout::paintSeparators().

+ Here is the caller graph for this function:

◆ contains() [2/2]

bool QRegion::contains ( const QRect & r) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns true if the region overlaps the rectangle r; otherwise returns false.

◆ crbegin()

QRegion::crbegin ( ) const
inlinenoexcept
Since
5.8

Same as rbegin().

Definition at line 54 of file qregion.h.

◆ crend()

QRegion::crend ( ) const
inlinenoexcept
Since
5.8

Same as rend().

Definition at line 56 of file qregion.h.

◆ end()

QRegion::end ( ) const
noexcept
Since
5.8

Returns a const_iterator pointing to one past the end of non-overlapping rectangles that make up the region.

The union of all the rectangles is equal to the original region.

See also
rend(), cend(), begin()

Referenced by QXcbBackingStore::endPaint(), qRegionToWinRegion(), and qt_regionToPath().

+ Here is the caller graph for this function:

◆ intersected() [1/2]

QRegion QRegion::intersected ( const QRect & rect) const
Since
4.4

Returns a region which is the intersection of this region and the given rect.

See also
subtracted(), united(), xored()

◆ intersected() [2/2]

QRegion QRegion::intersected ( const QRegion & r) const
Since
4.2

Returns a region which is the intersection of this region and r.

Region Intersection

The figure shows the intersection of two elliptical regions.

See also
subtracted(), united(), xored()

Referenced by QSGSoftwareRenderableNode::addDirtyRegion(), QBlitterPaintEngine::fillRect(), QOpenGL2PaintEngineExPrivate::fillStencilWithVertexArray(), QAlphaPaintEnginePrivate::fullyContained(), operator&(), operator&(), QXcbBackingStoreImage::scroll(), QWidgetPrivate::scrollRect(), and QX11PaintEngine::updateClipRegion_dev().

+ Here is the caller graph for this function:

◆ intersects() [1/2]

bool QRegion::intersects ( const QRect & rect) const
Since
4.2

Returns true if this region intersects with rect, otherwise returns false.

◆ intersects() [2/2]

bool QRegion::intersects ( const QRegion & region) const
Since
4.2

Returns true if this region intersects with region, otherwise returns false.

Definition at line 613 of file qregion.cpp.

References boundingRect(), isEmpty(), rect_intersects(), and rectCount().

Referenced by QSGSoftwareRenderableNode::addDirtyRegion(), QWidgetRepaintManager::bltRect(), QAlphaPaintEnginePrivate::canSeeTroughBackground(), QFbScreen::doRedraw(), QGraphicsScenePrivate::drawSubtreeRecursive(), QOpenGL2PaintEngineExPrivate::fillStencilWithVertexArray(), QXcbBackingStoreImage::flushScrolledRegion(), QWidgetPrivate::overlappedRegion(), QXcbBackingStoreImage::preparePaint(), and QSGSoftwareRenderableNode::subtractDirtyRegion().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isEmpty()

bool QRegion::isEmpty ( ) const

Returns true if the region is empty; otherwise returns false.

An empty region is a region that contains no points.

Example:

QRegion r1(10, 10, 20, 20);
r1.isEmpty(); // false
r3.isEmpty(); // true
QRegion r2(40, 40, 20, 20);
r3 = r1.intersected(r2); // r3: intersection of r1 and r2
r3.isEmpty(); // true
r3 = r1.united(r2); // r3: union of r1 and r2
r3.isEmpty(); // false

Referenced by QOpenGL2PaintEngineEx::begin(), QQnxRasterWindow::blitPreviousToCurrent(), QFbScreen::doRedraw(), QLinuxFbDrmScreen::doRedraw(), QWidgetPrivate::drawWidget(), QtWaylandClient::QWaylandXdgSurface::handleExpose(), QCocoaWindow::handleExposeEvent(), QBackingStore::hasStaticContents(), intersects(), QWidgetPrivate::invalidateBackingStore_resizeHelper(), QWidgetRepaintManager::isDirty(), QSGSoftwareRenderableNode::isDirtyRegionEmpty(), QCocoaWindow::isOpaque(), QWidgetRepaintManager::markDirty(), QWidgetRepaintManager::markNeedsFlush(), QSGAbstractSoftwareRenderer::optimizeRenderList(), QQnxRasterWindow::post(), QWidgetPrivate::prepareToRender(), QGuiApplicationPrivate::processExposeEvent(), qt_mac_clip_cg(), QQuickShapeSoftwareRenderNode::render(), QSGSoftwareRenderableNode::renderNode(), QQuickWidgetPrivate::renderSceneGraph(), QWindowsBackingStore::resize(), scaleRegion(), QQC2::scaleRegion(), QtWaylandClient::QWaylandWindow::setGeometry(), QWasmWindow::setMask(), QCocoaWindow::setMask(), QIOSWindow::setMask(), QWindowsWindow::setMask(), QXcbWindow::setMask(), QtWaylandClient::QWaylandWindow::setMask(), QPaintEnginePrivate::setSystemTransformAndViewport(), QPaintEnginePrivate::setSystemViewport(), QWidgetRepaintManager::staticContents(), QSGSoftwareRenderableNode::subtractDirtyRegion(), QWidgetRepaintManager::sync(), QRasterPaintEnginePrivate::systemStateChanged(), QOpenGL2PaintEngineExPrivate::systemStateChanged(), QTest::toString(), QSGSoftwareRenderableNode::update(), QPaintEnginePrivate::updateSystemClip(), and src_gui_painting_qregion_unix::wrapper().

+ Here is the caller graph for this function:

◆ isNull()

bool QRegion::isNull ( ) const
Since
5.0

Returns true if the region is empty; otherwise returns false. An empty region is a region that contains no points. This function is the same as isEmpty

See also
isEmpty()

Referenced by QSGSoftwareRenderableNodeUpdater::endVisit(), QXcbBackingStoreImage::flushScrolledRegion(), QTest::toString(), QWasmBackingStore::updateTexture(), and QSGSoftwareRenderableNodeUpdater::visit().

+ Here is the caller graph for this function:

◆ operator QVariant()

QRegion::operator QVariant ( ) const

Returns the region as a QVariant.

Definition at line 549 of file qregion.cpp.

References QVariant::fromValue().

+ Here is the call graph for this function:

◆ operator!=()

bool QRegion::operator!= ( const QRegion & r) const
inline

Returns true if this region is different from the other region; otherwise returns false.

Definition at line 97 of file qregion.h.

References operator==().

+ Here is the call graph for this function:

◆ operator&() [1/2]

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

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

Since
4.4

Definition at line 433 of file qregion.cpp.

References intersected().

+ Here is the call graph for this function:

◆ operator&() [2/2]

QRegion QRegion::operator& ( const QRegion & r) const

Applies the intersected() function to this region and r.

r1&r2 is equivalent to r1.intersected(r2).

See also
intersected()

Definition at line 426 of file qregion.cpp.

References intersected().

+ Here is the call graph for this function:

◆ operator&=() [1/2]

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

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

Since
4.4

Definition at line 511 of file qregion.cpp.

References QRegion().

+ Here is the call graph for this function:

◆ operator&=() [2/2]

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

Applies the intersected() function to this region and r and assigns the result to this region.

r1&=r2 is equivalent to r1 = r1.intersected(r2).

See also
intersected()

Definition at line 498 of file qregion.cpp.

◆ operator+() [1/2]

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

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

Since
4.4

Definition at line 417 of file qregion.cpp.

References united().

+ Here is the call graph for this function:

◆ operator+() [2/2]

QRegion QRegion::operator+ ( const QRegion & r) const

Applies the united() function to this region and r.

r1+r2 is equivalent to r1.united(r2).

See also
united(), operator|()

Definition at line 410 of file qregion.cpp.

References united().

+ Here is the call graph for this function:

◆ operator+=() [1/2]

QRegion & QRegion::operator+= ( const QRect & rect)

Returns a region that is the union of this region with the specified rect.

See also
united()

Definition at line 483 of file qregion.cpp.

References QRegion(), and operator+=().

+ Here is the call graph for this function:

◆ operator+=() [2/2]

QRegion & QRegion::operator+= ( const QRegion & r)

Applies the united() function to this region and r and assigns the result to this region.

r1+=r2 is equivalent to {r1 = r1.united(r2)}.

See also
intersected()

Referenced by operator+=().

+ Here is the caller graph for this function:

◆ operator-()

QRegion QRegion::operator- ( const QRegion & r) const

Applies the subtracted() function to this region and r.

r1-r2 is equivalent to r1.subtracted(r2).

See also
subtracted()

Definition at line 444 of file qregion.cpp.

References subtracted().

+ Here is the call graph for this function:

◆ operator-=()

QRegion & QRegion::operator-= ( const QRegion & r)

Applies the subtracted() function to this region and r and assigns the result to this region.

r1-=r2 is equivalent to {r1 = r1.subtracted(r2)}.

See also
subtracted()

Definition at line 526 of file qregion.cpp.

◆ operator=()

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

Assigns r to this region and returns a reference to the region.

Move-assigns other to this QRegion instance.

Since
5.2

◆ operator==()

bool QRegion::operator== ( const QRegion & r) const

Returns true if the region is equal to r; otherwise returns false.

◆ operator^()

QRegion QRegion::operator^ ( const QRegion & r) const

Applies the xored() function to this region and r.

r1^r2 is equivalent to r1.xored(r2).

See also
xored()

Definition at line 453 of file qregion.cpp.

References xored().

+ Here is the call graph for this function:

◆ operator^=()

QRegion & QRegion::operator^= ( const QRegion & r)

Applies the xored() function to this region and r and assigns the result to this region.

r1^=r2 is equivalent to {r1 = r1.xored(r2)}.

See also
xored()

Definition at line 536 of file qregion.cpp.

◆ operator|()

QRegion QRegion::operator| ( const QRegion & r) const

Applies the united() function to this region and r.

r1|r2 is equivalent to r1.united(r2).

See also
united(), operator+()

Definition at line 401 of file qregion.cpp.

References united().

+ Here is the call graph for this function:

◆ operator|=()

QRegion & QRegion::operator|= ( const QRegion & r)

Applies the united() function to this region and r and assigns the result to this region.

r1|=r2 is equivalent to {r1 = r1.united(r2)}.

See also
united()

Definition at line 463 of file qregion.cpp.

◆ rbegin()

QRegion::rbegin ( ) const
inlinenoexcept
Since
5.8

Returns a const_reverse_iterator pointing to the beginning of the range of non-overlapping rectangles that make up the region.

The union of all the rectangles is equal to the original region.

See also
begin(), crbegin(), rend()

Definition at line 53 of file qregion.h.

Referenced by QQnxRasterWindow::blitPreviousToCurrent().

+ Here is the caller graph for this function:

◆ rectCount()

int QRegion::rectCount ( ) const
noexcept

◆ rend()

QRegion::rend ( ) const
inlinenoexcept
Since
5.8

Returns a const_reverse_iterator pointing to one past the end of the range of non-overlapping rectangles that make up the region.

The union of all the rectangles is equal to the original region.

See also
end(), crend(), rbegin()

Definition at line 55 of file qregion.h.

References begin().

Referenced by QQnxRasterWindow::blitPreviousToCurrent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setRects()

void QRegion::setRects ( const QRect * rects,
int number )

Sets the region using the array of rectangles specified by rects and number.

The rectangles must be optimally Y-X sorted and follow these restrictions:

\list

  • The rectangles must not intersect.
  • All rectangles with a given top coordinate must have the same height.
  • No two rectangles may abut horizontally (they should be combined into a single wider rectangle in that case).
  • The rectangles must be sorted in ascending order, with Y as the major sort key and X as the minor sort key. \endlist \omit Only some platforms have these restrictions (Qt for Embedded Linux, X11 and \macos). \endomit

Referenced by QAlphaPaintEnginePrivate::canSeeTroughBackground(), qt_mac_scale_region(), and scaledRegion().

+ Here is the caller graph for this function:

◆ subtracted()

QRegion QRegion::subtracted ( const QRegion & r) const
Since
4.2

Returns a region which is r subtracted from this region.

Region Subtraction

The figure shows the result when the ellipse on the right is subtracted from the ellipse on the left ({left - right}).

See also
intersected(), united(), xored()

Referenced by operator-(), QSGAbstractSoftwareRenderer::optimizeRenderList(), and QSGSoftwareRenderableNode::previousDirtyRegion().

+ Here is the caller graph for this function:

◆ swap()

void QRegion::swap ( QRegion & other)
inlinenoexcept
Since
4.8

Swaps region other with this region. This operation is very fast and never fails.

Definition at line 42 of file qregion.h.

References d, other(), and qt_ptr_swap().

Referenced by QQuickWidget::paintEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ translate() [1/2]

void QRegion::translate ( const QPoint & point)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Translates the region {point}{.x()} along the x axis and {point}{.y()} along the y axis, relative to the current position.

Positive values move the region to the right and down.

Translates to the given point.

Definition at line 62 of file qregion.h.

References translate().

Referenced by translate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ translate() [2/2]

void QRegion::translate ( int dx,
int dy )

Translates (moves) the region dx along the X axis and dy along the Y axis.

Referenced by QWidgetPrivate::overlappedRegion(), QGraphicsItem::scroll(), QGraphicsView::scrollContentsBy(), QWidgetPrivate::scrollRect(), QWidgetRepaintManager::staticContents(), QWidgetPrivate::subtractOpaqueSiblings(), and QPaintEnginePrivate::updateSystemClip().

+ Here is the caller graph for this function:

◆ translated() [1/2]

QRegion QRegion::translated ( const QPoint & p) const
inline

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

Since
4.1

Returns a copy of the regtion that is translated {p}{.x()} along the x axis and {p}{.y()} 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 64 of file qregion.h.

References translated().

Referenced by translated().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ translated() [2/2]

QRegion QRegion::translated ( int dx,
int dy ) const
Since
4.1

Returns a copy of the region that is translated dx along the x axis and dy along the y axis, relative to the current position. Positive values move the region to the right and down.

See also
translate()

Definition at line 593 of file qregion.cpp.

References ret.

Referenced by QtWaylandClient::QWaylandShmBackingStore::beginPaint(), QWidget::childrenRegion(), QtWaylandClient::QWaylandShmBackingStore::flush(), QWidgetRepaintManager::markDirty(), QWidgetRepaintManager::markNeedsFlush(), QWidgetPrivate::moveRect(), QWidgetPrivate::overlappedRegion(), QTableView::paintEvent(), QXcbBackingStoreImage::put(), QWidgetPrivate::render(), QHighDpi::scale(), QXcbBackingStoreImage::scroll(), QCALayerBackingStore::scroll(), QPixmap::scroll(), QWidgetPrivate::subtractOpaqueSiblings(), and QGraphicsPixmapItemPrivate::updateShape().

+ Here is the caller graph for this function:

◆ united() [1/2]

QRegion QRegion::united ( const QRect & rect) const
Since
4.4

Returns a region which is the union of this region and the given rect.

See also
intersected(), subtracted(), xored()

◆ united() [2/2]

QRegion QRegion::united ( const QRegion & r) const
Since
4.2

Returns a region which is the union of this region and r.

Region Union

The figure shows the union of two elliptical regions.

See also
intersected(), subtracted(), xored()

Referenced by operator+(), operator+(), and operator|().

+ Here is the caller graph for this function:

◆ xored()

QRegion QRegion::xored ( const QRegion & r) const
Since
4.2

Returns a region which is the exclusive or (XOR) of this region and r.

Region XORed

The figure shows the exclusive or of two elliptical regions.

See also
intersected(), united(), subtracted()

Referenced by operator^().

+ Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ operator<< [1/2]

QDataStream & operator<< ( QDataStream & s,
const QRegion & r )
friend

Writes the region r to the stream s and returns a reference to the stream.

See also
{Serializing Qt Data Types}{Format of the QDataStream operators}

Definition at line 313 of file qregion.cpp.

◆ operator<<() [2/2]

QDataStream & operator<< ( QDataStream & s,
const QRegion & r )
related

Writes the region r to the stream s and returns a reference to the stream.

See also
{Serializing Qt Data Types}{Format of the QDataStream operators}

Definition at line 313 of file qregion.cpp.

◆ operator>> [1/2]

QDataStream & operator>> ( QDataStream & s,
QRegion & r )
friend

Reads a region from the stream s into r and returns a reference to the stream.

See also
{Serializing Qt Data Types}{Format of the QDataStream operators}

Definition at line 347 of file qregion.cpp.

◆ operator>>() [2/2]

QDataStream & operator>> ( QDataStream & s,
QRegion & r )
related

Reads a region from the stream s into r and returns a reference to the stream.

See also
{Serializing Qt Data Types}{Format of the QDataStream operators}

Definition at line 347 of file qregion.cpp.

◆ QRegionPrivate

friend struct QRegionPrivate
friend

Definition at line 116 of file qregion.h.

◆ qt_region_strictContains

Q_GUI_EXPORT friend bool qt_region_strictContains ( const QRegion & region,
const QRect & rect )
friend

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