QRectF intersected(const QRectF &rectangle) const 返回该矩形与矩形 rectangle 的交集(即两矩形的重叠区域),注意:r1.intersected(r2)相当 于r1&r2。 2)、 bool intersects(const QRectF &rectangle) const; //若该矩形与矩形 rectangle 相交,则返回 true。 3)、 QRectF united(const QRectF &rectangle) const...
qDebug() << curRect1.intersected(curRect2);//QRectF(100,100 100x200) qDebug() << curRect1.united(curRect2);//QRectF(0,0 400x400) QRectF curRect5(0, 0, 400, 400); QRectF curRect6(10, 10, 200, 200); qDebug() << curRect5.contains(curRect2);//true QRectF curRect3(0,...
bool r.intersects(r1)是否与其他相交,若要返回相交区域则使用intersected QRectF r.united(r1)返回与其他矩形的并集所在的大矩形 bool r.contains(r1或者p1)是否包含其他矩形或者点 QRectF r.normalize()将宽和高变为正数,实际上只是将坐标从右下角移动到了左上角,从而宽高都变为正数 QGraphicsItem.moveBy(qrea...
United()函数返回相交矩形的并集。 isEmpty()函数返回true如果left()>right()或者top()>bottom().注意一个空的矩形是无效的。isValid()函数返回true,如果left()<=right()并且top()<=bottom().一个空的矩形(isNull()==true)在其他的手上,宽和高都是0. 注意:由于QRect和QRectF被定义,一个空的QRect被定...
QRectFboundingRectB; for(autoitem:groupB->childItems()){ boundingRectB=boundingRectB.united(item->boundingRect().translated(item->pos())); } // 检查两个组的边界矩形是否相交 returnboundingRectA.intersects(boundingRectB); } // 示例:如何调用这个函数来检测 collision ...
void addRect(const QRectF & rectangle) void addRect(qreal x, qreal y, qreal width, qreal height) void addRegion(const QRegion & region) void addRoundedRect(const QRectF & rect, qreal xRadius, qreal yRadius, Qt::SizeMode mode = Qt::AbsoluteSize) void addRoundedRect(qreal x, qreal y, ...
(since 6.4) QRectF toRectF() const int top() const QPoint topLeft() const QPoint topRight() const void translate(int dx, int dy) void translate(const QPoint &offset) QRect translated(int dx, int dy) const QRect translated(const QPoint &offset) const QRect transposed() const QRect...
QRectF boundingRectFor(constQRectF &sourceRect); public: voidsetDistance(qreal distance); qreal distance(); voidsetBlurRadius(qreal ); qreal blurRadius(); voidsetColor(constQColor&); QColor color(); private: //阴影边距 qreal m_distance; ...
QRectFboundingRect() const boolcontainsPoint(const QPointF &point, Qt::FillRulefillRule) const QPolygonFintersected(const QPolygonF &r) const boolisClosed() const QPolygonFsubtracted(const QPolygonF &r) const voidswap(QPolygonF &other) QPolygontoPolygon() const ...
QRectFQPolygonF::boundingRect() const Returns the bounding rectangle of the polygon, orQRectF(0,0,0,0) if the polygon is empty. See alsoQList::isEmpty(). boolQPolygonF::containsPoint(constQPointF&point,Qt::FillRulefillRule) const Returnstrueif the givenpointis inside the polygon according to ...