QRectF 类
QRectF 类使用浮点精度定义平面上有限矩形。 更多...
| 头文件 | #include <QRectF> | 
| CMake | find_package(Qt6 REQUIRED COMPONENTS Core) target_link_libraries(mytarget PRIVATE Qt6::Core) | 
| qmake | QT += core | 
- 所有成员列表,包括继承的成员
- QRectF 是 绘画类 的一部分。
注意: 此类中所有函数均 可重入。
共有函数
| QRectF() | |
| QRectF(const QPointF &topLeft, const QSizeF &size) | |
| QRectF(const QPointF &topLeft, const QPointF &bottomRight) | |
| QRectF(qreal x, qreal y, qreal width, qreal height) | |
| QRectF(const QRect &rectangle) | |
| void | adjust(qreal dx1, qreal dy1, qreal dx2, qreal dy2) | 
| QRectF | adjusted(qreal dx1, qreal dy1, qreal dx2, qreal dy2) const | 
| qreal | bottom() const | 
| QPointF | bottomLeft() const | 
| QPointF | bottomRight() const | 
| QPointF | center() const | 
| bool | contains(const QPointF &point) const | 
| bool | contains(const QRectF &rectangle) const | 
| bool | contains(qreal x, qreal ) const | 
| void | getCoords(qreal *x1, qreal *y1, qreal *x2, qreal *y2) const | 
| void | getRect(qreal *x, qreal *y, qreal *width, qreal *height) const | 
| qreal | height() const | 
| QRectF | intersected(const QRectF &rectangle) const | 
| bool | intersects(const QRectF &rectangle) const | 
| bool | isEmpty() const | 
| bool | isNull() const | 
| bool | isValid() const | 
| qreal | left() const | 
| QRectF | marginsAdded(const QMarginsF &margins) const | 
| QRectF | marginsRemoved(const QMarginsF &margins) const | 
| void | moveBottom(qreal y) | 
| void | moveBottomLeft(const QPointF &position) | 
| void | moveBottomRight(const QPointF &position) | 
| void | moveCenter(const QPointF &position) | 
| void | moveLeft(qreal x) | 
| void | moveRight(qreal x) | 
| void | moveTo(qreal x, qreal y) | 
| void | moveTo(const QPointF &position) | 
| void | moveTop(qreal y) | 
| void | moveTopLeft(const QPointF &position) | 
| void | moveTopRight(const QPointF &position) | 
| QRectF | normalized() const | 
| qreal | right() const | 
| void | setBottom(qreal y) | 
| void | setBottomLeft(const QPointF &position) | 
| void | setBottomRight(const QPointF &position) | 
| void | setCoords(qreal x1, qreal y1, qreal x2, qreal y2) | 
| void | setHeight(qreal height) | 
| void | setLeft(qreal x) | 
| void | setRect(qreal x, qreal y, qreal width, qreal height) | 
| void | setRight(qreal x) | 
| void | setSize(const QSizeF &size) | 
| void | setTop(qreal y) | 
| void | setTopLeft(const QPointF &position) | 
| void | setTopRight(const QPointF &position) | 
| void | setWidth(qreal width) | 
| void | setX(qreal x) | 
| void | setY(qreal y) | 
| QSizeF | size() const | 
| QRect | toAlignedRect() const | 
| CGRect | toCGRect() const | 
| (since 6.5)emscripten::val | toDOMRect() const | 
| QRect | toRect() const | 
| qreal | top() const | 
| QPointF | topLeft() const | 
| QPointF | topRight() const | 
| void | translate(qreal dx, qreal dy) | 
| void | translate(const QPointF &offset) | 
| QRectF | translated(qreal dx, qreal dy) const | 
| QRectF | translated(const QPointF &offset) const | 
| QRectF | transposed() const | 
| QRectF | united(const QRectF &rectangle) const | 
| qreal | width() const | 
| qreal | x() const | 
| qreal | y() const | 
| QRectF | operator&(const QRectF &rectangle) const | 
| QRectF & | operator&=(const QRectF &rectangle) | 
| QRectF & | operator+=(const QMarginsF &margins) | 
| QRectF & | operator-=(const QMarginsF &margins) | 
| QRectF | operator|(const QRectF &rectangle) const | 
| QRectF & | operator|=(const QRectF &rectangle) | 
静态公共成员
| QRectF | fromCGRect(CGRect rect) | 
| (since 6.5)QRectF | fromDOMRect(emscripten::val domRect) | 
相关非成员
| bool | operator!=(const QRectF &r1, const QRectF &r2) | 
| QRectF | operator+(const QRectF &lhs, const QMarginsF &rhs) | 
| QRectF | operator+(const QMarginsF &lhs, const QRectF &rhs) | 
| QRectF | operator-(const QRectF &lhs, const QMarginsF &rhs) | 
| QDataStream & | operator<<(QDataStream &stream, const QRectF &rectangle) | 
| bool | operator==(const QRectF &r1, const QRectF &r2) | 
| QDataStream & | operator>>(QDataStream &stream, QRectF &rectangle) | 
详细描述
矩形通常用左上角和大小来表示。QRectF的大小(宽度和高度)始终等效于形成其渲染基础的数学矩形。
可以使用一组左、上、宽度和高度坐标,或从QPointF和QSizeF构建QRectF。以下代码创建了两个相同的矩形。
还有一个第三个构造函数,可以从QRect创建QRectF,以及相应的toRect()函数,该函数根据矩形的值返回一个QRect对象(请注意,返回矩形中的坐标已四舍五入到最接近的整数)。
QRectF类提供了一组返回各种矩形坐标并提供修改这些坐标的函数。QRectF还提供了使矩形相对于各种坐标移动的函数。此外,还有一个moveTo()函数,该函数移动矩形,将左上角置于指定的坐标。或者,translate()函数将矩形移动给定的偏移量相对于当前位置,而translated()函数返回此矩形的平移副本。
size()函数返回矩形的尺寸作为QSizeF。尺寸也可以使用width()和height()函数单独检索。要修改尺寸,请使用setSize()、setWidth()或setHeight()函数。或者,可以通过应用设置矩形坐标的函数来更改大小,例如setBottom()或setRight()。
contains()函数指示一个给定点是否位于矩形内,而intersects()函数如果此矩形与给定矩形相交(否则为false),返回true。QRectF类还提供了返回交点矩形的intersected()函数,以及返回包围给定矩形和united()函数的矩形的函数
isEmpty()函数如果矩形的宽度或高度小于或等于0,则返回true。请注意,空矩形不是有效的:如果宽度、高度均大于0,则isValid()函数返回true。另一方面,一个空矩形(isNull() == true)具有宽度、高度均设置为0。
请注意,由于QRect和QRectF的定义方式,空QRectF基本上是以与QRect相同的方式定义的。
最后,QRectF对象可以像进行比较一样进行序列化。
渲染
当使用抗锯齿绘图器时,QRectF的边界线将在数学矩形边界线的两侧对称渲染。但使用具有锯齿边缘的绘图器(默认值)时,会应用其他规则。
然后,当使用宽度为一像素的画笔绘制时,QRectF的边界线将绘制在数学矩形边界线的右侧和下方。
当使用宽度为两像素的画笔绘制时,边界线将在数学矩形的中间被分割。当画笔设置为偶数像素时,这种情况总是会发生,而当使用奇数像素的画笔时,多余的像素将像一像素的情况一样绘制在数学矩形的右侧和下方。
|  |  | 
| 逻辑表示 | 一像素宽画笔 | 
|  |  | 
| 两像素宽画笔 | 三像素宽画笔 | 
坐标
QRectF类提供了一系列函数,用于返回各种矩形的坐标并允许操作它们。QRectF还提供了函数,可以相对于各种坐标移动矩形。
例如:bottom(),setBottom() 和 moveBottom() 函数:bottom() 返回矩形的底部边的y坐标,setBottom() 将矩形的底部边设置为给定的y坐标(它可能会更改高度,但永远不会更改矩形的顶部边缘)和 moveBottom() 将整个矩形垂直移动,同时保持矩形的底部边缘在给定的y坐标处且大小不变。

还可以使用 adjust() 函数向此矩形的坐标添加偏移量,以及使用 adjusted() 函数根据原始矩形的调整获取一个新矩形。如果宽度和高度中的任何一个为负,则使用 normalized() 函数来获取一个将角落交换的矩形。
此外,QRectF还提供了 getCoords() 函数,用于提取矩形的左上角和右下角的位置,以及getRect() 函数,用于提取矩形的左上角、宽度和高度。可以使用 setCoords() 和 setRect() 函数一步操作矩形的坐标和尺寸。
成员函数文档
[constexpr noexcept] QRectF::QRectF()
构建一个空矩形。
另请参阅isNull。
[constexpr noexcept] QRectF::QRectF(const QPointF &topLeft, const QSizeF &size)
使用给定的topLeft角和给定的size构建一个矩形。
另请参阅setTopLeft()和setSize。
[constexpr noexcept] QRectF::QRectF(const QPointF &topLeft, const QPointF &bottomRight)
使用给定的topLeft和bottomRight角构建一个矩形。
另请参阅 setTopLeft() 和 setBottomRight()。
[constexpr noexcept] QRectF::QRectF(qreal x, qreal y, qreal width, qreal height)
使用左上角坐标为 (x, y),以及给定的 width 和 height 构建一个矩形。所有参数必须是有穷数。
另请参阅 setRect()。
[constexpr noexcept] QRectF::QRectF(const QRect &rectangle)
从给定的 QRect rectangle 构造一个 QRectF 矩形。
注意: 此函数,如同 QRect::toRectF(),保留了 rectangle 的 size(),而不是它的 bottomRight() 角。
另请参阅 toRect() 和 QRect::toRectF()。
[constexpr noexcept] void QRectF::adjust(qreal dx1, qreal dy1, qreal dx2, qreal dy2)
分别为矩形的现有坐标分别加上 dx1、dy1、dx2 和 dy2。所有参数必须是有穷数。
[constexpr noexcept] QRectF QRectF::adjusted(qreal dx1, qreal dy1, qreal dx2, qreal dy2) const
返回一个新的矩形,新坐标为现有坐标分别加上 dx1、dy1、dx2 和 dy2。所有参数必须是有穷数。
另请参阅 adjust()。
[constexpr noexcept] qreal QRectF::bottom() const
返回矩形的底边 y 坐标。
另请参阅 setBottom()、bottomLeft() 和 bottomRight()。
[constexpr noexcept] QPointF QRectF::bottomLeft() const
返回矩形的左下角位置。
另请参阅 setBottomLeft()、bottom() 和 left()。
[constexpr noexcept] QPointF QRectF::bottomRight() const
返回矩形右下角的位置。
另请参阅 setBottomRight(),bottom(),和 right()。
[constexpr noexcept] QPointF QRectF::center() const
返回矩形的中心点。
另请参阅 moveCenter()。
[noexcept] bool QRectF::contains(const QPointF &point) const
如果给定的 point 在矩形内或矩形边上,则返回 true;否则返回 false。
另请参阅 intersects()。
[noexcept] bool QRectF::contains(const QRectF &rectangle) const
这是一个重载函数。
如果给定的 rectangle 在此矩形内,则返回 true;否则返回 false。
[noexcept] bool QRectF::contains(qreal x, qreal y) const
这是一个重载函数。
如果点 (x, y) 在矩形内或矩形边上,则返回 true;否则返回 false。
[static noexcept] QRectF QRectF::fromCGRect(CGRect rect)
从 CGRect rect 创建一个 QRectF。
另请参阅 toCGRect()。
[static, since 6.5] QRectF QRectF::fromDOMRect(emscripten::val domRect)
将 DOMRect (https://www.w3.org/TR/geometry-1/) domRect 转换为 QRectF。如果提供的参数不是 DOMRect,则该行为是未定义的。
此函数在 Qt 6.5 中引入。
另请参阅 toDOMRect()。
[constexpr] void QRectF::getCoords(qreal *x1, qreal *y1, qreal *x2, qreal *y2) const
将矩形的左上角位置提取到 *x1 和 *y1,并将矩形的右下角位置提取到 *x2 和 *y2。
[constexpr] void QRectF::getRect(qreal *x, qreal *y, qreal *width, qreal *height) const
提取矩形左上角的坐标到 *x 和 *y,并且其尺寸到 *width 和 *height。
[constexpr noexcept] qreal QRectF::height() const
返回矩形的宽度。
另请参阅setHeight(),width() 和 size().
[noexcept] QRectF QRectF::intersected(const QRectF &rectangle) const
返回此矩形与给定 rectangle 的交集。注意,r.intersected(s) 等价于 r & s。

另请参阅intersects(),united() 和 operator&=().
[noexcept] bool QRectF::intersects(const QRectF &rectangle) const
如果此矩形与给定 rectangle 交叉(即它们之间有一个非空的 overlap 区域),则返回 true,否则返回 false。
可以使用 intersected() 函数检索交集矩形。
另请参阅contains().
[constexpr noexcept] bool QRectF::isEmpty() const
如果矩形为空,则返回 true,否则返回 false。
一个空矩形具有 width() <= 0 或 height() <= 0。一个空矩形无效(即 isEmpty() == !isValid()).
使用 normalized() 函数检索 corner 交换的矩形。
另请参阅isNull(),isValid() 和 normalized().
[constexpr noexcept] bool QRectF::isNull() const
如果矩形是一个 null 矩形,则返回 true,否则返回 false。
A null rectangle has both the width and the height set to 0. A null rectangle is also empty, and hence not valid.
[constexpr noexcept] bool QRectF::isValid() const
如果矩形有效,则返回 true,否则返回 false。
有效的矩形必须满足宽(width()) > 0 且高(height()) > 0。注意,对于无效矩形,非平凡操作(如交集)未定义。有效矩形不为空(即,isValid() == !isEmpty())。
另请参阅isNull(),isEmpty() 和 normalized()。
[constexpr noexcept] qreal QRectF::left() const
返回矩形左侧的x坐标。等价于 x()。
另请参阅setLeft(),topLeft() 和 bottomLeft()。
[constexpr noexcept] QRectF QRectF::marginsAdded(const QMarginsF &margins) const
返回增加边框(margins)的矩形。
另请参阅operator+=(),marginsRemoved() 和 operator-=()。
[constexpr noexcept] QRectF QRectF::marginsRemoved(const QMarginsF &margins) const
从矩形中减去边框(margins),使其缩小。
另请参阅marginsAdded(),operator+=() 和 operator-=()。
[constexpr noexcept] void QRectF::moveBottom(qreal y)
垂直移动矩形,使矩形的底部边缘处于给定的有限 y 坐标。矩形的大小保持不变。
另请参阅bottom(),setBottom() 和 moveTop()。
[constexpr noexcept] void QRectF::moveBottomLeft(const QPointF &position)
移动矩形,使矩形的左下角位于给定的 position。矩形的大小保持不变。
另请参阅setBottomLeft(),moveBottom() 和 moveLeft()。
[constexpr noexcept] void QRectF::moveBottomRight(const QPointF &position)
移动矩形,使矩形的右下角位于给定的 position。矩形的大小保持不变。
另请参阅setBottomRight(),moveBottom() 和 moveRight()。
[constexpr noexcept] void QRectF::moveCenter(const QPointF &position)
移动矩形,使矩形的中心点位于给定的 position。矩形的大小保持不变。
另请参阅 center().
[constexpr noexcept] void QRectF::moveLeft(qreal x)
将矩形水平移动,使矩形的左边缘位于给定的有限x坐标。矩形的尺寸保持不变。
另请参阅 left(),setLeft() 以及 moveRight().
[constexpr noexcept] void QRectF::moveRight(qreal x)
将矩形水平移动,使矩形的右边缘位于给定的有限 x 坐标。矩形的尺寸保持不变。
另请参阅 right(),setRight() 以及 moveLeft().
[constexpr noexcept] void QRectF::moveTo(qreal x, qreal y)
将矩形移动到给定的位置(《i translate="no">x,y)。矩形的尺寸保持不变。两个参数都必须是有限的。
另请参阅 translate() 和 moveTopLeft().
[constexpr noexcept] void QRectF::moveTo(const QPointF &position)
这是一个重载函数。
将矩形移动到给定的 position。
[constexpr noexcept] void QRectF::moveTop(qreal y)
将矩形垂直移动,使矩形的顶部边线位于给定的有限 y 坐标。矩形的尺寸保持不变。
另请参阅 top(),setTop() 以及 moveBottom().
[constexpr noexcept] void QRectF::moveTopLeft(const QPointF &position)
将矩形移动到给定的 position。矩形的尺寸保持不变。
另请参阅 setTopLeft(),moveTop() 以及 moveLeft().
[constexpr noexcept] void QRectF::moveTopRight(const QPointF &position)
将矩形移动到给定的 position。矩形的尺寸保持不变。
另请参阅 setTopRight(),moveTop() 以及 moveRight().
[noexcept] QRectF QRectF::normalized() const
返回一个归一化矩形;即一个具有非负宽度和高度的矩形。
如果 width() < 0,则函数交换左右角,如果 height() < 0,则交换上下角。
[constexpr noexcept] qreal QRectF::right() const
返回矩形的右边界的 x 坐标。
另请参阅 setRight(),topRight() 和 bottomRight()。
[constexpr noexcept] void QRectF::setBottom(qreal y)
将矩形的底部边设置为给定的有限 y 坐标。可能改变高度,但不会改变矩形的顶部边缘。
另请参阅 bottom() 和 moveBottom()。
[constexpr noexcept] void QRectF::setBottomLeft(const QPointF &position)
将矩形的左下角设置为给定的 position。可能改变大小,但不会改变矩形的右上角。
另请参阅 bottomLeft() 和 moveBottomLeft()。
[constexpr noexcept] void QRectF::setBottomRight(const QPointF &position)
将矩形的右下角设置为给定的 position。可能改变大小,但不会改变矩形的左上角。
另请参阅 bottomRight() 和 moveBottomRight()。
[constexpr noexcept] void QRectF::setCoords(qreal x1, qreal y1, qreal x2, qreal y2)
将矩形左上角的坐标设置为 (x1, y1),将右下角的坐标设置为 (x2, y2)。所有参数必须是有限的。
[constexpr noexcept] void QRectF::setHeight(qreal height)
将矩形的高度设置为给定的有限 height。底部边缘将改变,但顶部边缘不会改变。
[constexpr noexcept] void QRectF::setLeft(qreal x)
将矩形的左边沿设置为指定的有限x坐标。可能会更改宽度,但绝不会更改矩形的右边沿。
等价于setX().
[constexpr noexcept] void QRectF::setRect(qreal x, qreal y, qreal width, qreal height)
将矩形的左上角坐标设置为(x, y),并将大小设置为给定的width和height。所有参数都必须是有限的。
[constexpr noexcept] void QRectF::setRight(qreal x)
将矩形的右边沿设置为给定的有限x坐标。可能会更改宽度,但绝不会更改矩形的左边沿。
[constexpr noexcept] void QRectF::setSize(const QSizeF &size)
将矩形的尺寸设置为给定的有限size。左上角不会被移动。
另见size()、setWidth()和setHeight().
[constexpr noexcept] void QRectF::setTop(qreal y)
将矩形的上边沿设置为给定的有限y坐标。可能会更改高度,但绝不会更改矩形的下边沿。
等价于setY().
[constexpr noexcept] void QRectF::setTopLeft(const QPointF &position)
将矩形的左上角设置为给定的position。可能会改变尺寸,但绝不会改变矩形的右下角。
另见topLeft()和moveTopLeft().
[constexpr noexcept] void QRectF::setTopRight(const QPointF &position)
将矩形的右上角设置为给定的position。可能会改变尺寸,但绝不会改变矩形的左下角。
另见topRight()和moveTopRight().
[constexpr noexcept] void QRectF::setWidth(qreal 宽度)
设置矩形的宽度为指定的有限宽度。右边缘会改变,而左边缘不会。
[constexpr noexcept] void QRectF::setX(qreal x)
将矩形的左边沿设置为指定的有限x坐标。可能会更改宽度,但绝不会更改矩形的右边沿。
相当于 setLeft().
参见x(),setY() 和 setTopLeft().
[constexpr noexcept] void QRectF::setY(qreal y)
将矩形的上边沿设置为给定的有限y坐标。可能会更改高度,但绝不会更改矩形的下边沿。
相当于 setTop().
参见y(),setX 和 setTopLeft().
[constexpr noexcept] QSizeF QRectF::size() const
返回矩形的尺寸。
[noexcept] QRect QRectF::toAlignedRect() const
返回基于此矩形值的 QRect,它是完全包含此矩形的可能的最小整数矩形。
参见toRect().
[noexcept] CGRect QRectF::toCGRect() const
从 QRectF 创建一个 CGRect。
参见fromCGRect().
[since 6.5] emscripten::val QRectF::toDOMRect() const
将此对象转换为 DOMRect (https://www.w3.org/TR/geometry-1/).
此函数在 Qt 6.5 中引入。
参见fromDOMRect().
[constexpr noexcept] QRect QRectF::toRect() const
返回一个基于此矩形值的 QRect。注意,返回的矩形中的坐标已四舍五入到最接近的整数。
参见QRectF,toAlignedRect 和 QRect::toRectF().
[constexpr noexcept] qreal QRectF::top() const
返回矩形顶部边界的 y 坐标。相当于 y().
参见setTop(),topLeft 和 topRight().
[constexpr noexcept] QPointF QRectF::topLeft() const
返回矩形的左上角位置。
另请参阅setTopLeft(),top() 和 left()。
[constexpr noexcept] QPointF QRectF::topRight() const
返回矩形的右上角位置。
另请参阅setTopRight(),top() 和 right()。
[constexpr noexcept] void QRectF::translate(qreal dx, qreal dy)
将矩形沿x轴移动 dx 并沿y轴移动 dy,相对于当前位置。正值将矩形向右和向下移动。两个参数都必须是有限的。
另请参阅moveTopLeft(),moveTo() 和 translated()。
[constexpr noexcept] void QRectF::translate(const QPointF &offset)
这是一个重载函数。
将矩形沿 offset.x() 轴和 offset.y() 轴移动,相对于当前位置。
[constexpr noexcept] QRectF QRectF::translated(qreal dx, qreal dy) const
返回一个矩形的副本,该副本沿x轴移动 dx 并沿y轴移动 dy,相对于当前位置。正值将矩形向右和向下移动。两个参数都必须是有限的。
另请参阅translate()。
[constexpr noexcept] QRectF QRectF::translated(const QPointF &offset) const
这是一个重载函数。
返回一个矩形的副本,该副本沿 offset.x() 轴和 offset.y() 轴移动,相对于当前位置。
[constexpr noexcept] QRectF QRectF::transposed() const
返回宽度与高度互换了矩形副本。
QRectF r = {1.5, 5.1, 4.2, 2.4}; r = r.transposed(); // r == {1.5, 5.1, 2.4, 4.2}
另请参阅QSizeF::transposed()。
[noexcept] QRectF QRectF::united(const QRectF &rectangle) const
返回此矩形与给定 rectangle 的包围矩形。

另请参阅intersected()。
[constexpr noexcept] qreal QRectF::width() const
返回矩形的宽度。
另请参阅setWidth(),height(),和 size()。
[constexpr noexcept] qreal QRectF::x() const
返回矩形左边缘的x坐标。等价于 left。
[constexpr noexcept] qreal QRectF::y() const
返回矩形上边缘的y坐标。等价于 top。
[noexcept] QRectF QRectF::operator&(const QRectF &rectangle) const
返回此矩形与给定矩形rectangle的交集。如果没有交集,则返回一个空矩形。
另请参阅operator&=() 和 intersected。
[noexcept] QRectF &QRectF::operator&=(const QRectF &rectangle)
将此矩形与给定矩形rectangle相交。
另请参阅intersected() 和 operator&。
[constexpr noexcept] QRectF &QRectF::operator+=(const QMarginsF &margins)
将margins添加到矩形中,扩展它。
另请参阅marginsAdded(),marginsRemoved(),和 operator-=。
[constexpr noexcept] QRectF &QRectF::operator-=(const QMarginsF &margins)
返回缩小了margins的矩形。
另请参阅marginsRemoved(),operator+=(),和 marginsAdded。
[noexcept] QRectF QRectF::operator|(const QRectF &rectangle) const
返回此矩形与给定 rectangle 的包围矩形。
[noexcept] QRectF &QRectF::operator|=(const QRectF &rectangle)
将此矩形与给定的 rectangle 合并。
相关非成员
[constexpr noexcept] bool operator!=(const QRectF &r1, const QRectF &r2)
如果矩形 r1 和 r2 足够不同,则返回 true,否则返回 false。
注意:该函数不检查严格不等式;它使用模糊比较来比较矩形的坐标。
[constexpr noexcept] QRectF operator+(const QRectF &lhs, const QMarginsF &rhs)
返回通过 rhs 边距扩展的 lhs 矩形。
[constexpr noexcept] QRectF operator+(const QMarginsF &lhs, const QRectF &rhs)
这是一个重载函数。
返回通过 rhs 边距扩展的 lhs 矩形。
[constexpr noexcept] QRectF operator-(const QRectF &lhs, const QMarginsF &rhs)
返回通过 rhs 边距收缩的 lhs 矩形。
QDataStream &operator<<(QDataStream &stream, const QRectF &rectangle)
将 rectangle 写入 stream,并返回对流的引用。
另请参阅序列化 Qt 数据类型。
[constexpr noexcept] bool operator==(const QRectF &r1, const QRectF &r2)
如果矩形 r1 和 r2 大概相等,则返回 true,否则返回 false。
注意:该函数不检查严格相等;它使用模糊比较来比较矩形的坐标。
另请参阅qFuzzyCompare。
QDataStream &operator>>(QDataStream &stream, QRectF &rectangle)
从 stream 读取一个 rectangle,并返回对流的引用。
另请参阅序列化 Qt 数据类型。
© 2024 Qt公司有限公司。本文档中包含的贡献文档的版权属于其各自的所有者。本文件所提供的文档根据免费软件基金会发布的GNU自由文档许可版本1.3条款进行许可。Qt及其相关标志是芬兰以及世界各地的Qt公司有限公司的商标。所有其他商标均为其各自所有者的财产。