QRegion Class
The QRegion class specifies a clip region for a painter. More…
| Header | #include <QRegion> |
|---|---|
| CMake | target_link_libraries(app PRIVATE Nt::Gui) |
| Module | Nt 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) | |
| bool | isEmpty() const |
| bool | isNull() const |
| QRect | boundingRect() const |
| std::vector<QRect> | rects() const |
| int | rectCount() const |
| bool | contains(const QPoint &point) const |
| bool | intersects(const QRect &rect) const |
| QRegion | united(const QRect &rect) const |
| QRegion | united(const QRegion &other) const |
| QRegion | intersected(const QRect &rect) const |
| QRegion | intersected(const QRegion &other) const |
| QRegion | translated(int dx, int dy) const |
| QRegion | translated(const QPoint &offset) const |
| void | translate(int dx, int dy) |
| QRegion & | operator+=(const QRect &rect) |
| QRegion & | operator+=(const QRegion &other) |
| QRegion | operator+(const QRect &rect) const |
| QRegion | operator+(const QRegion &other) const |
| QRegion | operator&(const QRect &rect) const |
| QRegion | operator&(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.
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.