KWin::RectF Class
The RectF type represents a rectangle with floating point coordinates. More...
| Header: | #include <core/rect.h> |
| CMake: | find_package(KWin REQUIRED)target_link_libraries(mytarget PRIVATE KWin::kwin) |
Properties
Public Functions
| RectF() | |
| RectF(Qt::Initialization) | |
| RectF(const KWin::Rect &rect) | |
| RectF(const QRect &rect) | |
| RectF(const QRectF &rect) | |
| RectF(const QPointF &topLeft, const QPointF &bottomRight) | |
| RectF(const QPointF &topLeft, const QSizeF &size) | |
| RectF(qreal x, qreal y, qreal width, qreal height) | |
| void | adjust(qreal x1, qreal y1, qreal x2, qreal y2) |
| KWin::RectF | adjusted(qreal x1, qreal y1, qreal x2, qreal y2) const |
| qreal | bottom() const |
| QPointF | bottomLeft() const |
| QPointF | bottomRight() const |
| QPointF | center() const |
| bool | contains(const KWin::RectF &rect) const |
| bool | contains(const QPointF &point) const |
| bool | contains(qreal x, qreal y) const |
| void | getCoords(qreal *x1, qreal *y1, qreal *x2, qreal *y2) const |
| void | getRect(qreal *x, qreal *y, qreal *width, qreal *height) const |
| KWin::RectF | grownBy(const QMarginsF &margins) const |
| qreal | height() const |
| KWin::RectF | intersected(const KWin::RectF &other) const |
| bool | intersects(const KWin::RectF &other) const |
| bool | isEmpty() const |
| bool | isNull() const |
| bool | isValid() const |
| qreal | left() const |
| KWin::RectF | marginsAdded(const QMarginsF &margins) const |
| KWin::RectF | marginsRemoved(const QMarginsF &margins) const |
| void | moveBottom(qreal bottom) |
| void | moveBottomLeft(const QPointF &point) |
| void | moveBottomRight(const QPointF &point) |
| void | moveCenter(const QPointF &point) |
| void | moveLeft(qreal left) |
| void | moveRight(qreal right) |
| void | moveTo(const QPointF &point) |
| void | moveTo(qreal x, qreal y) |
| void | moveTop(qreal top) |
| void | moveTopLeft(const QPointF &point) |
| void | moveTopRight(const QPointF &point) |
| qreal | right() const |
| KWin::Rect | rounded() const |
| KWin::Rect | roundedIn() const |
| KWin::Rect | roundedOut() const |
| void | scale(qreal scale) |
| void | scale(qreal xScale, qreal yScale) |
| KWin::RectF | scaled(qreal scale) const |
| KWin::RectF | scaled(qreal xScale, qreal yScale) const |
| void | setBottom(qreal bottom) |
| void | setBottomLeft(const QPointF &point) |
| void | setBottomRight(const QPointF &point) |
| void | setCoords(qreal x1, qreal y1, qreal x2, qreal y2) |
| void | setHeight(qreal height) |
| void | setLeft(qreal left) |
| void | setRect(qreal x, qreal y, qreal width, qreal height) |
| void | setRight(qreal right) |
| void | setSize(const QSizeF &size) |
| void | setTop(qreal top) |
| void | setTopLeft(const QPointF &point) |
| void | setTopRight(const QPointF &point) |
| void | setWidth(qreal width) |
| void | setX(qreal x) |
| void | setY(qreal y) |
| KWin::RectF | shrunkBy(const QMarginsF &margins) const |
| QSizeF | size() const |
| KWin::Rect | toAlignedRect() const |
| KWin::Rect | toRect() const |
| qreal | top() const |
| QPointF | topLeft() const |
| QPointF | topRight() const |
| void | translate(const QPointF &offset) |
| void | translate(qreal dx, qreal dy) |
| KWin::RectF | translated(const QPointF &offset) const |
| KWin::RectF | translated(qreal dx, qreal dy) const |
| KWin::RectF | transposed() const |
| KWin::RectF | united(const KWin::RectF &other) const |
| qreal | width() const |
| qreal | x() const |
| qreal | y() const |
| operator QRectF() const | |
| KWin::RectF | operator&(const KWin::RectF &other) const |
| KWin::RectF & | operator&=(const KWin::RectF &other) |
| KWin::RectF & | operator+=(const QMarginsF &margins) |
| KWin::RectF & | operator-=(const QMarginsF &margins) |
| bool | operator==(const KWin::RectF &other) const |
| KWin::RectF | operator|(const KWin::RectF &other) const |
| KWin::RectF & | operator|=(const KWin::RectF &other) |
Detailed Description
Property Documentation
height : qreal
The height of the rectangle
Access functions:
width : qreal
The width of the rectangle
Access functions:
x : qreal
The x coordinate of the top left corner
Access functions:
y : qreal
The y coordinate of the top left corner
Access functions:
Member Function Documentation
[constexpr noexcept] RectF::RectF()
Constructs an empty rectangle.
[explicit constexpr noexcept] RectF::RectF(Qt::Initialization)
Constructs an uninitialized RectF.
[constexpr noexcept] RectF::RectF(const KWin::Rect &rect)
Constructs a RectF from the specified Rect rect.
[constexpr noexcept] RectF::RectF(const QRect &rect)
Constructs a RectF from the specified QRect rect.
[constexpr noexcept] RectF::RectF(const QRectF &rect)
Constructs a RectF from the specified QRectF rect.
[constexpr noexcept] RectF::RectF(const QPointF &topLeft, const QPointF &bottomRight)
Constructs a rectangle with the specified topLeft and bottomRight corners.
[constexpr noexcept] RectF::RectF(const QPointF &topLeft, const QSizeF &size)
Constructs a rectangle with the specified topLeft position and size.
[constexpr noexcept] RectF::RectF(qreal x, qreal y, qreal width, qreal height)
Constructs a rectangle with the specified coordinates (x, and y), and the size (width, and height).
[constexpr noexcept] void RectF::adjust(qreal x1, qreal y1, qreal x2, qreal y2)
Adds x1, y1, x2, and y2 to the left, top, right, and bottom edge coordinates, respectively. This may change the size of the rectangle.
This function is provided for compatibility reasons with QRectF.
Prefer using grownBy() or shrunkBy().
See also adjusted(), grownBy(), and shrunkBy().
[constexpr noexcept] KWin::RectF RectF::adjusted(qreal x1, qreal y1, qreal x2, qreal y2) const
Returns a copy of this rectangle with x1, y1, x2, and y2 added to its left, top, right, and bottom edge coordinates, respectively. This may change the size of the rectangle.
This function is provided for compatibility reasons with QRectF.
Prefer using grownBy() or shrunkBy().
See also adjust(), grownBy(), and shrunkBy().
[constexpr noexcept] qreal RectF::bottom() const
Returns the bottom edge coordinate. This equivalent to y() + height().
See also setBottom() and moveBottom().
[constexpr noexcept] QPointF RectF::bottomLeft() const
Returns the bottom-left corner of the rectangle.
See also setBottomLeft() and moveBottomLeft().
[constexpr noexcept] QPointF RectF::bottomRight() const
Returns the bottom-right corner of the rectangle.
See also setBottomRight() and moveBottomRight().
[constexpr noexcept] QPointF RectF::center() const
Returns the center point of the rectangle.
See also moveCenter().
[constexpr noexcept] bool RectF::contains(const KWin::RectF &rect) const
Returns true if the specified rect is inside this rectangle; otherwise returns false. If the rectangle is empty, this function returns false.
[constexpr noexcept] bool RectF::contains(const QPointF &point) const
Returns true if the specified point is inside this rectangle; otherwise returns false. If the rectangle is empty, this function returns false.
The left and top edges are considered to be inside the rectangle, while the right and bottom edges are not. In other words, this checks left() <= point.x() < right(), and top() <= point.y() < bottom().
[constexpr noexcept] bool RectF::contains(qreal x, qreal y) const
This is an overloaded function.
[constexpr] void RectF::getCoords(qreal *x1, qreal *y1, qreal *x2, qreal *y2) const
Writes the rectangle's top-left corner position to x1 and y1, and its bottom-right corner position to x2 and y2.
This function is provided for compatibility reasons with QRectF.
See also setCoords().
[constexpr] void RectF::getRect(qreal *x, qreal *y, qreal *width, qreal *height) const
Writes the rectangle's top-left corner position to x and y, and its size to width and height.
This function is provided for compatibility reasons with QRectF.
See also setRect().
[constexpr noexcept] KWin::RectF RectF::grownBy(const QMarginsF &margins) const
Returns a copy of this rectangle grown by the given margins.
See also shrunkBy().
[constexpr noexcept] qreal RectF::height() const
Returns the height of the rectangle.
Note: Getter function for property height.
See also setHeight().
[constexpr noexcept] KWin::RectF RectF::intersected(const KWin::RectF &other) const
Returns the intersection of this rectangle and the given other rectangle. If the rectangles don't intersect, an empty rectangle will be returned.
See also intersects().
[constexpr noexcept] bool RectF::intersects(const KWin::RectF &other) const
Returns true if this rectangle and the given other rectangle intersect; otherwise returns false.
See also intersected().
[constexpr noexcept] bool RectF::isEmpty() const
Returns true if the rectangle is empty; otherwise returns false. An empty rectangle has left() >= right() or top() >= bottom() or both.
See also isNull() and isValid().
[constexpr noexcept] bool RectF::isNull() const
Returns true if the rectangle is empty; otherwise returns false. An empty rectangle has left() >= right() or top() >= bottom() or both.
This function is provided for compatibility reasons with QRectF. It is identical to isEmpty(). Prefer using isEmpty().
See also isEmpty() and isValid().
[constexpr noexcept] bool RectF::isValid() const
Returns true if the rectangle is empty; otherwise returns false. An empty rectangle has left() >= right() or top() >= bottom() or both.
This function is provided for compatibility reasons with QRectF. It is identical to isEmpty(). Prefer using isEmpty().
See also isEmpty() and isNull().
[constexpr noexcept] qreal RectF::left() const
Returns the left edge coordinate. Equivalent to x().
See also x(), setLeft(), and moveLeft().
[constexpr noexcept] KWin::RectF RectF::marginsAdded(const QMarginsF &margins) const
Returns a copy of this rectangle grown by the given margins. Equivalent to grownBy().
This function is provided for compatibility reasons with QRectF.
See also shrunkBy() and marginsRemoved().
[constexpr noexcept] KWin::RectF RectF::marginsRemoved(const QMarginsF &margins) const
Returns a copy of this rectangle shrunk by the given margins. Equivalent to shrunkBy().
This function is provided for compatibility reasons with QRectF.
See also grownBy() and marginsAdded().
[constexpr noexcept] void RectF::moveBottom(qreal bottom)
Moves the rectangle vertically so its bottom edge is left at the specified position bottom. The size of the rectangle won't be changed.
See also bottom() and setBottom().
[constexpr noexcept] void RectF::moveBottomLeft(const QPointF &point)
Moves the rectangle so its bottom-left corner is left at the specified position point. The size of the rectangle won't be changed.
See also bottomLeft() and setBottomLeft().
[constexpr noexcept] void RectF::moveBottomRight(const QPointF &point)
Moves the rectangle so its bottom-right corner is left at the specified position point. The size of the rectangle won't be changed.
See also bottomRight() and setBottomRight().
[constexpr noexcept] void RectF::moveCenter(const QPointF &point)
Moves the rectangle so its center point is at the specified position point. This does not change the size of the rectangle.
See also center().
[constexpr noexcept] void RectF::moveLeft(qreal left)
Moves the rectangle horizontally so its left edge is left at the specified position left. The size of the rectangle won't be changed.
See also left() and setLeft().
[constexpr noexcept] void RectF::moveRight(qreal right)
Moves the rectangle horizontally so its right edge is left at the specified position right. The size of the rectangle won't be changed.
See also right() and setRight().
[constexpr noexcept] void RectF::moveTo(const QPointF &point)
Moves the top-left corner of the rectangle to the specified point. Equivalent to moveTopLeft().
See also moveTopLeft().
[constexpr noexcept] void RectF::moveTo(qreal x, qreal y)
This is an overloaded function.
[constexpr noexcept] void RectF::moveTop(qreal top)
Moves the rectangle vertically so its top edge is left at the specified position top. The size of the rectangle won't be changed.
[constexpr noexcept] void RectF::moveTopLeft(const QPointF &point)
Moves the rectangle so its top-left corner is left at the specified position point. The size of the rectangle won't be changed.
See also topLeft() and setTopLeft().
[constexpr noexcept] void RectF::moveTopRight(const QPointF &point)
Moves the rectangle so its top-right corner is left at the specified position point. The size of the rectangle won't be changed.
See also topRight() and setTopRight().
[constexpr noexcept] qreal RectF::right() const
Returns the right edge coordinate. This equivalent to x() + width().
See also setRight() and moveRight().
[constexpr noexcept] KWin::Rect RectF::rounded() const
Returns a copy of this rectangle with its left, top, right, and bottom edge coordinates rounded to the nearest integers.
See also roundedIn() and roundedOut().
[constexpr noexcept] KWin::Rect RectF::roundedIn() const
Returns a copy of this rectangle whose left and top edge coordinates have been ceiled, and right and bottom edge coordinates have been floored.
See also rounded().
[constexpr noexcept] KWin::Rect RectF::roundedOut() const
Returns a copy of this rectangle whose left and top edge coordinates have been floored, and right and bottom edge coordinates have been ceiled.
See also rounded().
[constexpr noexcept] void RectF::scale(qreal scale)
Scales this rectangle along both the x and y axis by the given scale factor.
[constexpr noexcept] void RectF::scale(qreal xScale, qreal yScale)
Scales this rectangle along the x and y axis by the given xScale and yScale factors, respectively.
[constexpr noexcept] KWin::RectF RectF::scaled(qreal scale) const
Returns a copy of this rectangle with its x and y coordinates scaled by the given scale factor.
[constexpr noexcept] KWin::RectF RectF::scaled(qreal xScale, qreal yScale) const
Returns a copy of this rectangle with its x coordinates scaled by the given xScale factor and the y coordinates scaled by the yScale factor.
[constexpr noexcept] void RectF::setBottom(qreal bottom)
Sets the bottom edge coordinate to bottom. This may change the height of the rectangle.
See also bottom() and moveBottom().
[constexpr noexcept] void RectF::setBottomLeft(const QPointF &point)
Sets the bottom-left corner coordinates to point. This may change the width and the height of the rectangle.
See also bottomLeft() and moveBottomLeft().
[constexpr noexcept] void RectF::setBottomRight(const QPointF &point)
Sets the bottom-right corner coordinates to point. This may change the width and the height of the rectangle.
See also bottomRight() and moveBottomRight().
[constexpr noexcept] void RectF::setCoords(qreal x1, qreal y1, qreal x2, qreal y2)
Sets the rectangle's top-left corner position to (x1, and y1), and its bottom-right corner position to (x2, and y2).
This function is provided for compatibility reasons with QRectF.
See also getCoords().
[constexpr noexcept] void RectF::setHeight(qreal height)
Sets the height of the rectangle to height.
Note: Setter function for property height.
See also height().
[constexpr noexcept] void RectF::setLeft(qreal left)
Sets the left edge coordinate to left. This may change the width of the rectangle.
See also left(), moveLeft(), and setX().
[constexpr noexcept] void RectF::setRect(qreal x, qreal y, qreal width, qreal height)
Sets the rectangle's top-left corner position to (x, and y), and its size to (width, and height).
This function is provided for compatibility reasons with QRectF.
See also getRect().
[constexpr noexcept] void RectF::setRight(qreal right)
Sets the right edge coordinate to right. This may change the width of the rectangle.
See also right() and moveRight().
[constexpr noexcept] void RectF::setSize(const QSizeF &size)
Sets the size of the rectangle to size.
See also size().
[constexpr noexcept] void RectF::setTop(qreal top)
Sets the top edge coordinate to top. This may change the height of the rectangle.
See also top(), moveTop(), and setY().
[constexpr noexcept] void RectF::setTopLeft(const QPointF &point)
Sets the top-left corner coordinates to point. This may change the width and the height of the rectangle.
See also topLeft() and moveTopLeft().
[constexpr noexcept] void RectF::setTopRight(const QPointF &point)
Sets the top-right corner coordinates to point. This may change the width and the height of the rectangle.
See also topRight() and moveTopRight().
[constexpr noexcept] void RectF::setWidth(qreal width)
Sets the width of the rectangle to width.
Note: Setter function for property width.
See also width().
[constexpr noexcept] void RectF::setX(qreal x)
Sets the left edge coordinate to x. This may change the width of the rectangle. Equivalent to setLeft().
Note: Setter function for property x.
[constexpr noexcept] void RectF::setY(qreal y)
Sets the top edge coordinate to y. This may change the height of the rectangle. Equivalent to setTop().
Note: Setter function for property y.
[constexpr noexcept] KWin::RectF RectF::shrunkBy(const QMarginsF &margins) const
Returns a copy of this rectangle shrunk by the given margins.
See also grownBy().
[constexpr noexcept] QSizeF RectF::size() const
Returns the size of the rectangle.
See also setSize().
[constexpr noexcept] KWin::Rect RectF::toAlignedRect() const
Equivalent to roundedOut(). This function is provided for compatibility reasons with QRectF.
See also roundedOut().
[constexpr noexcept] KWin::Rect RectF::toRect() const
Equivalent to rounded(). This function is provided for compatibility reasons with QRectF.
Note: This function does not return the same values as QRectF::toRect().
See also rounded().
[constexpr noexcept] qreal RectF::top() const
Returns the top edge coordinate. Equivalent to y().
See also y(), setTop(), and moveTop().
[constexpr noexcept] QPointF RectF::topLeft() const
Returns the top-left corner of the rectangle.
See also setTopLeft() and moveTopLeft().
[constexpr noexcept] QPointF RectF::topRight() const
Returns the top-right corner of the rectangle.
See also setTopRight() and moveTopRight().
[constexpr noexcept] void RectF::translate(const QPointF &offset)
Moves the rectangle by adding the given offset to the rectangle coordinates. The size will be left unchanged.
[constexpr noexcept] void RectF::translate(qreal dx, qreal dy)
This is an overloaded function.
[constexpr noexcept] KWin::RectF RectF::translated(const QPointF &offset) const
Returns a copy of this rectangle with the given offset added to its coordinates. The size will be left unchanged.
[constexpr noexcept] KWin::RectF RectF::translated(qreal dx, qreal dy) const
This is an overloaded function.
[constexpr noexcept] KWin::RectF RectF::transposed() const
Returns a copy of this rectangle that has its width and height swapped.
[constexpr noexcept] KWin::RectF RectF::united(const KWin::RectF &other) const
Returns the bounding rectangle of this rectangle and the given other rectangle.
[constexpr noexcept] qreal RectF::width() const
Returns the width of the rectangle.
Note: Getter function for property width.
See also setWidth().
[constexpr noexcept] qreal RectF::x() const
Returns the left edge coordinate. Equivalent to left().
Note: Getter function for property x.
[constexpr noexcept] qreal RectF::y() const
Returns the top edge coordinate. Equivalent to top().
Note: Getter function for property y.
[constexpr noexcept] RectF::operator QRectF() const
Implicitly converts this rectangle to QRectF.
[constexpr noexcept] KWin::RectF RectF::operator&(const KWin::RectF &other) const
Returns the intersection of this rectangle and the given other rectangle. Equivalent to intersected().
See also intersected().
[constexpr noexcept] KWin::RectF &RectF::operator&=(const KWin::RectF &other)
Intersects this rectangle with the given other rectangle.
See also intersected() and operator&().
[constexpr noexcept] KWin::RectF &RectF::operator+=(const QMarginsF &margins)
Grows this rectangle by the given margins.
See also grownBy().
[constexpr noexcept] KWin::RectF &RectF::operator-=(const QMarginsF &margins)
Shrinks this rectangle by the given margins.
See also shrunkBy().
[constexpr noexcept] bool RectF::operator==(const KWin::RectF &other) const
Returns true if this rectangle and the other rectangle are equal; otherwise returns false.
[constexpr noexcept] KWin::RectF RectF::operator|(const KWin::RectF &other) const
Returns the bounding rectangle of this rectangle and the given other rectangle. Equivalent to united().
See also united().
[constexpr noexcept] KWin::RectF &RectF::operator|=(const KWin::RectF &other)
Unites this rectangle with the given other rectangle.