1 /****************************************************************************
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/
6 ** This file is part of the QtCore module of the Qt Toolkit.
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** GNU Lesser General Public License Usage
10 ** This file may be used under the terms of the GNU Lesser General Public
11 ** License version 2.1 as published by the Free Software Foundation and
12 ** appearing in the file LICENSE.LGPL included in the packaging of this
13 ** file. Please review the following information to ensure the GNU Lesser
14 ** General Public License version 2.1 requirements will be met:
15 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
17 ** In addition, as a special exception, Nokia gives you certain additional
18 ** rights. These rights are described in the Nokia Qt LGPL Exception
19 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
21 ** GNU General Public License Usage
22 ** Alternatively, this file may be used under the terms of the GNU General
23 ** Public License version 3.0 as published by the Free Software Foundation
24 ** and appearing in the file LICENSE.GPL included in the packaging of this
25 ** file. Please review the following information to ensure the GNU General
26 ** Public License version 3.0 requirements will be met:
27 ** http://www.gnu.org/copyleft/gpl.html.
30 ** Alternatively, this file may be used in accordance with the terms and
31 ** conditions contained in a signed written agreement between you and Nokia.
40 ****************************************************************************/
45 #include <QtCore/qsize.h>
46 #include <QtCore/qpoint.h>
49 #error qrect.h must be included before any header file that defines topLeft
57 class Q_CORE_EXPORT QRect
60 Q_DECL_CONSTEXPR QRect() : x1(0), y1(0), x2(-1), y2(-1) {}
61 Q_DECL_CONSTEXPR QRect(const QPoint &topleft, const QPoint &bottomright);
62 Q_DECL_CONSTEXPR QRect(const QPoint &topleft, const QSize &size);
63 Q_DECL_CONSTEXPR QRect(int left, int top, int width, int height);
65 Q_DECL_CONSTEXPR bool isNull() const;
66 Q_DECL_CONSTEXPR bool isEmpty() const;
67 Q_DECL_CONSTEXPR bool isValid() const;
69 Q_DECL_CONSTEXPR int left() const;
70 Q_DECL_CONSTEXPR int top() const;
71 Q_DECL_CONSTEXPR int right() const;
72 Q_DECL_CONSTEXPR int bottom() const;
73 QRect normalized() const;
75 Q_DECL_CONSTEXPR int x() const;
76 Q_DECL_CONSTEXPR int y() const;
77 void setLeft(int pos);
79 void setRight(int pos);
80 void setBottom(int pos);
84 void setTopLeft(const QPoint &p);
85 void setBottomRight(const QPoint &p);
86 void setTopRight(const QPoint &p);
87 void setBottomLeft(const QPoint &p);
89 Q_DECL_CONSTEXPR QPoint topLeft() const;
90 Q_DECL_CONSTEXPR QPoint bottomRight() const;
91 Q_DECL_CONSTEXPR QPoint topRight() const;
92 Q_DECL_CONSTEXPR QPoint bottomLeft() const;
93 Q_DECL_CONSTEXPR QPoint center() const;
95 void moveLeft(int pos);
96 void moveTop(int pos);
97 void moveRight(int pos);
98 void moveBottom(int pos);
99 void moveTopLeft(const QPoint &p);
100 void moveBottomRight(const QPoint &p);
101 void moveTopRight(const QPoint &p);
102 void moveBottomLeft(const QPoint &p);
103 void moveCenter(const QPoint &p);
105 inline void translate(int dx, int dy);
106 inline void translate(const QPoint &p);
107 Q_DECL_CONSTEXPR inline QRect translated(int dx, int dy) const;
108 Q_DECL_CONSTEXPR inline QRect translated(const QPoint &p) const;
110 void moveTo(int x, int t);
111 void moveTo(const QPoint &p);
113 void setRect(int x, int y, int w, int h);
114 inline void getRect(int *x, int *y, int *w, int *h) const;
116 void setCoords(int x1, int y1, int x2, int y2);
117 inline void getCoords(int *x1, int *y1, int *x2, int *y2) const;
119 inline void adjust(int x1, int y1, int x2, int y2);
120 Q_DECL_CONSTEXPR inline QRect adjusted(int x1, int y1, int x2, int y2) const;
122 Q_DECL_CONSTEXPR QSize size() const;
123 Q_DECL_CONSTEXPR int width() const;
124 Q_DECL_CONSTEXPR int height() const;
125 void setWidth(int w);
126 void setHeight(int h);
127 void setSize(const QSize &s);
129 QRect operator|(const QRect &r) const;
130 QRect operator&(const QRect &r) const;
131 QRect& operator|=(const QRect &r);
132 QRect& operator&=(const QRect &r);
134 bool contains(const QPoint &p, bool proper=false) const;
135 bool contains(int x, int y) const; // inline methods, _don't_ merge these
136 bool contains(int x, int y, bool proper) const;
137 bool contains(const QRect &r, bool proper = false) const;
138 QRect united(const QRect &other) const;
139 QRect intersected(const QRect &other) const;
140 bool intersects(const QRect &r) const;
142 #if QT_DEPRECATED_SINCE(5, 0)
143 QT_DEPRECATED QRect unite(const QRect &r) const { return united(r); }
144 QT_DEPRECATED QRect intersect(const QRect &r) const { return intersected(r); }
147 friend Q_CORE_EXPORT_INLINE Q_DECL_CONSTEXPR bool operator==(const QRect &, const QRect &);
148 friend Q_CORE_EXPORT_INLINE Q_DECL_CONSTEXPR bool operator!=(const QRect &, const QRect &);
156 Q_DECLARE_TYPEINFO(QRect, Q_MOVABLE_TYPE);
158 Q_CORE_EXPORT_INLINE Q_DECL_CONSTEXPR bool operator==(const QRect &, const QRect &);
159 Q_CORE_EXPORT_INLINE Q_DECL_CONSTEXPR bool operator!=(const QRect &, const QRect &);
162 /*****************************************************************************
163 QRect stream functions
164 *****************************************************************************/
165 #ifndef QT_NO_DATASTREAM
166 Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QRect &);
167 Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QRect &);
170 /*****************************************************************************
171 QRect inline member functions
172 *****************************************************************************/
174 Q_DECL_CONSTEXPR inline QRect::QRect(int aleft, int atop, int awidth, int aheight)
175 : x1(aleft), y1(atop), x2(aleft + awidth - 1), y2(atop + aheight - 1) {}
177 Q_DECL_CONSTEXPR inline QRect::QRect(const QPoint &atopLeft, const QPoint &abottomRight)
178 : x1(atopLeft.x()), y1(atopLeft.y()), x2(abottomRight.x()), y2(abottomRight.y()) {}
180 Q_DECL_CONSTEXPR inline QRect::QRect(const QPoint &atopLeft, const QSize &asize)
181 : x1(atopLeft.x()), y1(atopLeft.y()), x2(atopLeft.x()+asize.width() - 1), y2(atopLeft.y()+asize.height() - 1) {}
183 Q_DECL_CONSTEXPR inline bool QRect::isNull() const
184 { return x2 == x1 - 1 && y2 == y1 - 1; }
186 Q_DECL_CONSTEXPR inline bool QRect::isEmpty() const
187 { return x1 > x2 || y1 > y2; }
189 Q_DECL_CONSTEXPR inline bool QRect::isValid() const
190 { return x1 <= x2 && y1 <= y2; }
192 Q_DECL_CONSTEXPR inline int QRect::left() const
195 Q_DECL_CONSTEXPR inline int QRect::top() const
198 Q_DECL_CONSTEXPR inline int QRect::right() const
201 Q_DECL_CONSTEXPR inline int QRect::bottom() const
204 Q_DECL_CONSTEXPR inline int QRect::x() const
207 Q_DECL_CONSTEXPR inline int QRect::y() const
210 inline void QRect::setLeft(int pos)
213 inline void QRect::setTop(int pos)
216 inline void QRect::setRight(int pos)
219 inline void QRect::setBottom(int pos)
222 inline void QRect::setTopLeft(const QPoint &p)
223 { x1 = p.x(); y1 = p.y(); }
225 inline void QRect::setBottomRight(const QPoint &p)
226 { x2 = p.x(); y2 = p.y(); }
228 inline void QRect::setTopRight(const QPoint &p)
229 { x2 = p.x(); y1 = p.y(); }
231 inline void QRect::setBottomLeft(const QPoint &p)
232 { x1 = p.x(); y2 = p.y(); }
234 inline void QRect::setX(int ax)
237 inline void QRect::setY(int ay)
240 Q_DECL_CONSTEXPR inline QPoint QRect::topLeft() const
241 { return QPoint(x1, y1); }
243 Q_DECL_CONSTEXPR inline QPoint QRect::bottomRight() const
244 { return QPoint(x2, y2); }
246 Q_DECL_CONSTEXPR inline QPoint QRect::topRight() const
247 { return QPoint(x2, y1); }
249 Q_DECL_CONSTEXPR inline QPoint QRect::bottomLeft() const
250 { return QPoint(x1, y2); }
252 Q_DECL_CONSTEXPR inline QPoint QRect::center() const
253 { return QPoint((x1+x2)/2, (y1+y2)/2); }
255 Q_DECL_CONSTEXPR inline int QRect::width() const
256 { return x2 - x1 + 1; }
258 Q_DECL_CONSTEXPR inline int QRect::height() const
259 { return y2 - y1 + 1; }
261 Q_DECL_CONSTEXPR inline QSize QRect::size() const
262 { return QSize(width(), height()); }
264 inline void QRect::translate(int dx, int dy)
272 inline void QRect::translate(const QPoint &p)
280 Q_DECL_CONSTEXPR inline QRect QRect::translated(int dx, int dy) const
281 { return QRect(QPoint(x1 + dx, y1 + dy), QPoint(x2 + dx, y2 + dy)); }
283 Q_DECL_CONSTEXPR inline QRect QRect::translated(const QPoint &p) const
284 { return QRect(QPoint(x1 + p.x(), y1 + p.y()), QPoint(x2 + p.x(), y2 + p.y())); }
286 inline void QRect::moveTo(int ax, int ay)
294 inline void QRect::moveTo(const QPoint &p)
302 inline void QRect::moveLeft(int pos)
303 { x2 += (pos - x1); x1 = pos; }
305 inline void QRect::moveTop(int pos)
306 { y2 += (pos - y1); y1 = pos; }
308 inline void QRect::moveRight(int pos)
314 inline void QRect::moveBottom(int pos)
320 inline void QRect::moveTopLeft(const QPoint &p)
326 inline void QRect::moveBottomRight(const QPoint &p)
332 inline void QRect::moveTopRight(const QPoint &p)
338 inline void QRect::moveBottomLeft(const QPoint &p)
344 inline void QRect::getRect(int *ax, int *ay, int *aw, int *ah) const
352 inline void QRect::setRect(int ax, int ay, int aw, int ah)
360 inline void QRect::getCoords(int *xp1, int *yp1, int *xp2, int *yp2) const
368 inline void QRect::setCoords(int xp1, int yp1, int xp2, int yp2)
376 Q_DECL_CONSTEXPR inline QRect QRect::adjusted(int xp1, int yp1, int xp2, int yp2) const
377 { return QRect(QPoint(x1 + xp1, y1 + yp1), QPoint(x2 + xp2, y2 + yp2)); }
379 inline void QRect::adjust(int dx1, int dy1, int dx2, int dy2)
387 inline void QRect::setWidth(int w)
388 { x2 = (x1 + w - 1); }
390 inline void QRect::setHeight(int h)
391 { y2 = (y1 + h - 1); }
393 inline void QRect::setSize(const QSize &s)
395 x2 = (s.width() + x1 - 1);
396 y2 = (s.height() + y1 - 1);
399 inline bool QRect::contains(int ax, int ay, bool aproper) const
401 return contains(QPoint(ax, ay), aproper);
404 inline bool QRect::contains(int ax, int ay) const
406 return contains(QPoint(ax, ay), false);
409 inline QRect& QRect::operator|=(const QRect &r)
415 inline QRect& QRect::operator&=(const QRect &r)
421 inline QRect QRect::intersected(const QRect &other) const
423 return *this & other;
426 inline QRect QRect::united(const QRect &r) const
431 Q_DECL_CONSTEXPR inline bool operator==(const QRect &r1, const QRect &r2)
433 return r1.x1==r2.x1 && r1.x2==r2.x2 && r1.y1==r2.y1 && r1.y2==r2.y2;
436 Q_DECL_CONSTEXPR inline bool operator!=(const QRect &r1, const QRect &r2)
438 return r1.x1!=r2.x1 || r1.x2!=r2.x2 || r1.y1!=r2.y1 || r1.y2!=r2.y2;
441 #ifndef QT_NO_DEBUG_STREAM
442 Q_CORE_EXPORT QDebug operator<<(QDebug, const QRect &);
446 class Q_CORE_EXPORT QRectF
449 Q_DECL_CONSTEXPR QRectF() : xp(0.), yp(0.), w(0.), h(0.) {}
450 Q_DECL_CONSTEXPR QRectF(const QPointF &topleft, const QSizeF &size);
451 Q_DECL_CONSTEXPR QRectF(const QPointF &topleft, const QPointF &bottomRight);
452 Q_DECL_CONSTEXPR QRectF(qreal left, qreal top, qreal width, qreal height);
453 Q_DECL_CONSTEXPR QRectF(const QRect &rect);
455 Q_DECL_CONSTEXPR bool isNull() const;
456 Q_DECL_CONSTEXPR bool isEmpty() const;
457 Q_DECL_CONSTEXPR bool isValid() const;
458 QRectF normalized() const;
460 Q_DECL_CONSTEXPR inline qreal left() const { return xp; }
461 Q_DECL_CONSTEXPR inline qreal top() const { return yp; }
462 Q_DECL_CONSTEXPR inline qreal right() const { return xp + w; }
463 Q_DECL_CONSTEXPR inline qreal bottom() const { return yp + h; }
465 Q_DECL_CONSTEXPR inline qreal x() const;
466 Q_DECL_CONSTEXPR inline qreal y() const;
467 inline void setLeft(qreal pos);
468 inline void setTop(qreal pos);
469 inline void setRight(qreal pos);
470 inline void setBottom(qreal pos);
471 inline void setX(qreal pos) { setLeft(pos); }
472 inline void setY(qreal pos) { setTop(pos); }
474 Q_DECL_CONSTEXPR inline QPointF topLeft() const { return QPointF(xp, yp); }
475 Q_DECL_CONSTEXPR inline QPointF bottomRight() const { return QPointF(xp+w, yp+h); }
476 Q_DECL_CONSTEXPR inline QPointF topRight() const { return QPointF(xp+w, yp); }
477 Q_DECL_CONSTEXPR inline QPointF bottomLeft() const { return QPointF(xp, yp+h); }
478 Q_DECL_CONSTEXPR inline QPointF center() const;
480 void setTopLeft(const QPointF &p);
481 void setBottomRight(const QPointF &p);
482 void setTopRight(const QPointF &p);
483 void setBottomLeft(const QPointF &p);
485 void moveLeft(qreal pos);
486 void moveTop(qreal pos);
487 void moveRight(qreal pos);
488 void moveBottom(qreal pos);
489 void moveTopLeft(const QPointF &p);
490 void moveBottomRight(const QPointF &p);
491 void moveTopRight(const QPointF &p);
492 void moveBottomLeft(const QPointF &p);
493 void moveCenter(const QPointF &p);
495 void translate(qreal dx, qreal dy);
496 void translate(const QPointF &p);
498 Q_DECL_CONSTEXPR QRectF translated(qreal dx, qreal dy) const;
499 Q_DECL_CONSTEXPR QRectF translated(const QPointF &p) const;
501 void moveTo(qreal x, qreal t);
502 void moveTo(const QPointF &p);
504 void setRect(qreal x, qreal y, qreal w, qreal h);
505 void getRect(qreal *x, qreal *y, qreal *w, qreal *h) const;
507 void setCoords(qreal x1, qreal y1, qreal x2, qreal y2);
508 void getCoords(qreal *x1, qreal *y1, qreal *x2, qreal *y2) const;
510 inline void adjust(qreal x1, qreal y1, qreal x2, qreal y2);
511 Q_DECL_CONSTEXPR inline QRectF adjusted(qreal x1, qreal y1, qreal x2, qreal y2) const;
513 Q_DECL_CONSTEXPR QSizeF size() const;
514 Q_DECL_CONSTEXPR qreal width() const;
515 Q_DECL_CONSTEXPR qreal height() const;
516 void setWidth(qreal w);
517 void setHeight(qreal h);
518 void setSize(const QSizeF &s);
520 QRectF operator|(const QRectF &r) const;
521 QRectF operator&(const QRectF &r) const;
522 QRectF& operator|=(const QRectF &r);
523 QRectF& operator&=(const QRectF &r);
525 bool contains(const QPointF &p) const;
526 bool contains(qreal x, qreal y) const;
527 bool contains(const QRectF &r) const;
528 QRectF united(const QRectF &other) const;
529 QRectF intersected(const QRectF &other) const;
530 bool intersects(const QRectF &r) const;
532 #if QT_DEPRECATED_SINCE(5, 0)
533 QT_DEPRECATED QRectF unite(const QRectF &r) const { return united(r); }
534 QT_DEPRECATED QRectF intersect(const QRectF &r) const { return intersected(r); }
537 friend Q_CORE_EXPORT_INLINE Q_DECL_CONSTEXPR bool operator==(const QRectF &, const QRectF &);
538 friend Q_CORE_EXPORT_INLINE Q_DECL_CONSTEXPR bool operator!=(const QRectF &, const QRectF &);
540 Q_DECL_CONSTEXPR QRect toRect() const;
541 QRect toAlignedRect() const;
549 Q_DECLARE_TYPEINFO(QRectF, Q_MOVABLE_TYPE);
551 Q_CORE_EXPORT_INLINE Q_DECL_CONSTEXPR bool operator==(const QRectF &, const QRectF &);
552 Q_CORE_EXPORT_INLINE Q_DECL_CONSTEXPR bool operator!=(const QRectF &, const QRectF &);
555 /*****************************************************************************
556 QRectF stream functions
557 *****************************************************************************/
558 #ifndef QT_NO_DATASTREAM
559 Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QRectF &);
560 Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QRectF &);
563 /*****************************************************************************
564 QRectF inline member functions
565 *****************************************************************************/
567 Q_DECL_CONSTEXPR inline QRectF::QRectF(qreal aleft, qreal atop, qreal awidth, qreal aheight)
568 : xp(aleft), yp(atop), w(awidth), h(aheight)
572 Q_DECL_CONSTEXPR inline QRectF::QRectF(const QPointF &atopLeft, const QSizeF &asize)
573 : xp(atopLeft.x()), yp(atopLeft.y()), w(asize.width()), h(asize.height())
578 Q_DECL_CONSTEXPR inline QRectF::QRectF(const QPointF &atopLeft, const QPointF &abottomRight)
579 : xp(atopLeft.x()), yp(atopLeft.y()), w(abottomRight.x() - atopLeft.x()), h(abottomRight.y() - atopLeft.y())
583 Q_DECL_CONSTEXPR inline QRectF::QRectF(const QRect &r)
584 : xp(r.x()), yp(r.y()), w(r.width()), h(r.height())
588 Q_DECL_CONSTEXPR inline bool QRectF::isNull() const
589 { return w == 0. && h == 0.; }
591 Q_DECL_CONSTEXPR inline bool QRectF::isEmpty() const
592 { return w <= 0. || h <= 0.; }
594 Q_DECL_CONSTEXPR inline bool QRectF::isValid() const
595 { return w > 0. && h > 0.; }
597 Q_DECL_CONSTEXPR inline qreal QRectF::x() const
600 Q_DECL_CONSTEXPR inline qreal QRectF::y() const
603 inline void QRectF::setLeft(qreal pos) { qreal diff = pos - xp; xp += diff; w -= diff; }
605 inline void QRectF::setRight(qreal pos) { w = pos - xp; }
607 inline void QRectF::setTop(qreal pos) { qreal diff = pos - yp; yp += diff; h -= diff; }
609 inline void QRectF::setBottom(qreal pos) { h = pos - yp; }
611 inline void QRectF::setTopLeft(const QPointF &p) { setLeft(p.x()); setTop(p.y()); }
613 inline void QRectF::setTopRight(const QPointF &p) { setRight(p.x()); setTop(p.y()); }
615 inline void QRectF::setBottomLeft(const QPointF &p) { setLeft(p.x()); setBottom(p.y()); }
617 inline void QRectF::setBottomRight(const QPointF &p) { setRight(p.x()); setBottom(p.y()); }
619 Q_DECL_CONSTEXPR inline QPointF QRectF::center() const
620 { return QPointF(xp + w/2, yp + h/2); }
622 inline void QRectF::moveLeft(qreal pos) { xp = pos; }
624 inline void QRectF::moveTop(qreal pos) { yp = pos; }
626 inline void QRectF::moveRight(qreal pos) { xp = pos - w; }
628 inline void QRectF::moveBottom(qreal pos) { yp = pos - h; }
630 inline void QRectF::moveTopLeft(const QPointF &p) { moveLeft(p.x()); moveTop(p.y()); }
632 inline void QRectF::moveTopRight(const QPointF &p) { moveRight(p.x()); moveTop(p.y()); }
634 inline void QRectF::moveBottomLeft(const QPointF &p) { moveLeft(p.x()); moveBottom(p.y()); }
636 inline void QRectF::moveBottomRight(const QPointF &p) { moveRight(p.x()); moveBottom(p.y()); }
638 inline void QRectF::moveCenter(const QPointF &p) { xp = p.x() - w/2; yp = p.y() - h/2; }
640 Q_DECL_CONSTEXPR inline qreal QRectF::width() const
643 Q_DECL_CONSTEXPR inline qreal QRectF::height() const
646 Q_DECL_CONSTEXPR inline QSizeF QRectF::size() const
647 { return QSizeF(w, h); }
649 inline void QRectF::translate(qreal dx, qreal dy)
655 inline void QRectF::translate(const QPointF &p)
661 inline void QRectF::moveTo(qreal ax, qreal ay)
667 inline void QRectF::moveTo(const QPointF &p)
673 Q_DECL_CONSTEXPR inline QRectF QRectF::translated(qreal dx, qreal dy) const
674 { return QRectF(xp + dx, yp + dy, w, h); }
676 Q_DECL_CONSTEXPR inline QRectF QRectF::translated(const QPointF &p) const
677 { return QRectF(xp + p.x(), yp + p.y(), w, h); }
679 inline void QRectF::getRect(qreal *ax, qreal *ay, qreal *aaw, qreal *aah) const
687 inline void QRectF::setRect(qreal ax, qreal ay, qreal aaw, qreal aah)
695 inline void QRectF::getCoords(qreal *xp1, qreal *yp1, qreal *xp2, qreal *yp2) const
703 inline void QRectF::setCoords(qreal xp1, qreal yp1, qreal xp2, qreal yp2)
711 inline void QRectF::adjust(qreal xp1, qreal yp1, qreal xp2, qreal yp2)
712 { xp += xp1; yp += yp1; w += xp2 - xp1; h += yp2 - yp1; }
714 Q_DECL_CONSTEXPR inline QRectF QRectF::adjusted(qreal xp1, qreal yp1, qreal xp2, qreal yp2) const
715 { return QRectF(xp + xp1, yp + yp1, w + xp2 - xp1, h + yp2 - yp1); }
717 inline void QRectF::setWidth(qreal aw)
720 inline void QRectF::setHeight(qreal ah)
723 inline void QRectF::setSize(const QSizeF &s)
729 inline bool QRectF::contains(qreal ax, qreal ay) const
731 return contains(QPointF(ax, ay));
734 inline QRectF& QRectF::operator|=(const QRectF &r)
740 inline QRectF& QRectF::operator&=(const QRectF &r)
746 inline QRectF QRectF::intersected(const QRectF &r) const
751 inline QRectF QRectF::united(const QRectF &r) const
756 Q_DECL_CONSTEXPR inline bool operator==(const QRectF &r1, const QRectF &r2)
758 return qFuzzyCompare(r1.xp, r2.xp) && qFuzzyCompare(r1.yp, r2.yp)
759 && qFuzzyCompare(r1.w, r2.w) && qFuzzyCompare(r1.h, r2.h);
762 Q_DECL_CONSTEXPR inline bool operator!=(const QRectF &r1, const QRectF &r2)
764 return !qFuzzyCompare(r1.xp, r2.xp) || !qFuzzyCompare(r1.yp, r2.yp)
765 || !qFuzzyCompare(r1.w, r2.w) || !qFuzzyCompare(r1.h, r2.h);
768 Q_DECL_CONSTEXPR inline QRect QRectF::toRect() const
770 return QRect(qRound(xp), qRound(yp), qRound(w), qRound(h));
773 #ifndef QT_NO_DEBUG_STREAM
774 Q_CORE_EXPORT QDebug operator<<(QDebug, const QRectF &);