6.0.0-rc4Source

QRegion Class

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

Header#include <QRegion>
CMaketarget_link_libraries(app PRIVATE Nt::Gui)
ModuleNt GUI C++ Classes

List of all members, including inherited members

Public Functions

QRegion()
QRegion(const QRect &rect)
QRegion(int x, int y, int w, int h)
boolisEmpty() const
boolisNull() const
QRectboundingRect() const
std::vector<QRect>rects() const
intrectCount() const
boolcontains(const QPoint &point) const
boolintersects(const QRect &rect) const
QRegionunited(const QRect &rect) const
QRegionunited(const QRegion &other) const
QRegionintersected(const QRect &rect) const
QRegionintersected(const QRegion &other) const
QRegiontranslated(int dx, int dy) const
QRegiontranslated(const QPoint &offset) const
voidtranslate(int dx, int dy)
QRegion &operator+=(const QRect &rect)
QRegion &operator+=(const QRegion &other)
QRegionoperator+(const QRect &rect) const
QRegionoperator+(const QRegion &other) const
QRegionoperator&(const QRect &rect) const
QRegionoperator&(const QRegion &other) const
QRegion &operator&=(const QRect &rect)

Detailed Description

A region is a set of integer rectangles. The window system reports the damaged part of a window as a region, and QPainter clips to one.

See also QPainter and QRect.

Differences from Qt

A region is stored as a list of rectangles that may overlap, and it is not simplified. The rectangles that rects() returns are therefore not the minimal decomposition Qt gives, but they cover the same pixels. There are no ellipse or polygon regions, subtracted() or xored(), and no QVariant conversion.

Member Function Documentation

QRegion::QRegion()

Constructs an empty region.

QRegion::QRegion(const QRect &rect)

Constructs a region that covers rect. A null or empty rect gives an empty region.

QRegion::QRegion(int x, int y, int w, int h)

This is an overloaded function.

Constructs a region that covers the rectangle at (x, y) with the size w by h.

QRect QRegion::boundingRect() const

Returns the smallest rectangle that contains the region, or an empty rectangle for an empty region.

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

Returns true if point lies inside the region.

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

Returns the part of this region that lies inside rect.

See also united().

QRegion QRegion::intersected(const QRegion &other) const

This is an overloaded function.

Returns the part of this region that lies inside other.

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

Returns true if rect overlaps the region.

bool QRegion::isEmpty() const

Returns true if the region covers no pixels.

bool QRegion::isNull() const

Returns true if the region covers no pixels. This is the same as isEmpty().

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

Returns intersected(rect).

QRegion QRegion::operator&(const QRegion &other) const

This is an overloaded function.

Returns intersected(other).

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

Intersects the region with rect and returns a reference to it.

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

Returns united(rect).

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

This is an overloaded function.

Returns united(other).

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

Adds rect to the region and returns a reference to it.

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

This is an overloaded function.

Adds the rectangles of other to the region and returns a reference to it.

int QRegion::rectCount() const

Returns the number of rectangles that rects() returns.

std::vector<QRect> QRegion::rects() const

Returns the rectangles that make up the region.

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

Moves the region by dx horizontally and dy vertically.

See also translated().

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

Returns a copy of the region moved by dx horizontally and dy vertically.

See also translate().

QRegion QRegion::translated(const QPoint &offset) const

This is an overloaded function.

Returns a copy of the region moved by offset.

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

Returns the region that covers this region and rect.

See also intersected().

QRegion QRegion::united(const QRegion &other) const

This is an overloaded function.

Returns the region that covers this region and other.