QtBase  v6.3.1
qrect.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2016 The Qt Company Ltd.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of the QtCore module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see https://www.qt.io/terms-conditions. For further
15 ** information use the contact form at https://www.qt.io/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 3 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL3 included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 3 requirements
23 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24 **
25 ** GNU General Public License Usage
26 ** Alternatively, this file may be used under the terms of the GNU
27 ** General Public License version 2.0 or (at your option) the GNU General
28 ** Public license version 3 or any later version approved by the KDE Free
29 ** Qt Foundation. The licenses are as published by the Free Software
30 ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31 ** included in the packaging of this file. Please review the following
32 ** information to ensure the GNU General Public License requirements will
33 ** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34 ** https://www.gnu.org/licenses/gpl-3.0.html.
35 **
36 ** $QT_END_LICENSE$
37 **
38 ****************************************************************************/
39 
40 #ifndef QRECT_H
41 #define QRECT_H
42 
43 #include <QtCore/qhashfunctions.h>
44 #include <QtCore/qmargins.h>
45 #include <QtCore/qsize.h>
46 #include <QtCore/qpoint.h>
47 
48 #ifdef topLeft
49 #error qrect.h must be included before any header file that defines topLeft
50 #endif
51 
52 #if defined(Q_OS_DARWIN) || defined(Q_QDOC)
53 struct CGRect;
54 #endif
55 
57 
58 class Q_CORE_EXPORT QRect
59 {
60 public:
61  constexpr QRect() noexcept : x1(0), y1(0), x2(-1), y2(-1) {}
62  constexpr QRect(const QPoint &topleft, const QPoint &bottomright) noexcept;
63  constexpr QRect(const QPoint &topleft, const QSize &size) noexcept;
64  constexpr QRect(int left, int top, int width, int height) noexcept;
65 
66  constexpr inline bool isNull() const noexcept;
67  constexpr inline bool isEmpty() const noexcept;
68  constexpr inline bool isValid() const noexcept;
69 
70  constexpr inline int left() const noexcept;
71  constexpr inline int top() const noexcept;
72  constexpr inline int right() const noexcept;
73  constexpr inline int bottom() const noexcept;
74  [[nodiscard]] QRect normalized() const noexcept;
75 
76  constexpr inline int x() const noexcept;
77  constexpr inline int y() const noexcept;
78  constexpr inline void setLeft(int pos) noexcept;
79  constexpr inline void setTop(int pos) noexcept;
80  constexpr inline void setRight(int pos) noexcept;
81  constexpr inline void setBottom(int pos) noexcept;
82  constexpr inline void setX(int x) noexcept;
83  constexpr inline void setY(int y) noexcept;
84 
85  constexpr inline void setTopLeft(const QPoint &p) noexcept;
86  constexpr inline void setBottomRight(const QPoint &p) noexcept;
87  constexpr inline void setTopRight(const QPoint &p) noexcept;
88  constexpr inline void setBottomLeft(const QPoint &p) noexcept;
89 
90  constexpr inline QPoint topLeft() const noexcept;
91  constexpr inline QPoint bottomRight() const noexcept;
92  constexpr inline QPoint topRight() const noexcept;
93  constexpr inline QPoint bottomLeft() const noexcept;
94  constexpr inline QPoint center() const noexcept;
95 
96  constexpr inline void moveLeft(int pos) noexcept;
97  constexpr inline void moveTop(int pos) noexcept;
98  constexpr inline void moveRight(int pos) noexcept;
99  constexpr inline void moveBottom(int pos) noexcept;
100  constexpr inline void moveTopLeft(const QPoint &p) noexcept;
101  constexpr inline void moveBottomRight(const QPoint &p) noexcept;
102  constexpr inline void moveTopRight(const QPoint &p) noexcept;
103  constexpr inline void moveBottomLeft(const QPoint &p) noexcept;
104  constexpr inline void moveCenter(const QPoint &p) noexcept;
105 
106  constexpr inline void translate(int dx, int dy) noexcept;
107  constexpr inline void translate(const QPoint &p) noexcept;
108  [[nodiscard]] constexpr inline QRect translated(int dx, int dy) const noexcept;
109  [[nodiscard]] constexpr inline QRect translated(const QPoint &p) const noexcept;
110  [[nodiscard]] constexpr inline QRect transposed() const noexcept;
111 
112  constexpr inline void moveTo(int x, int t) noexcept;
113  constexpr inline void moveTo(const QPoint &p) noexcept;
114 
115  constexpr inline void setRect(int x, int y, int w, int h) noexcept;
116  constexpr inline void getRect(int *x, int *y, int *w, int *h) const;
117 
118  constexpr inline void setCoords(int x1, int y1, int x2, int y2) noexcept;
119  constexpr inline void getCoords(int *x1, int *y1, int *x2, int *y2) const;
120 
121  constexpr inline void adjust(int x1, int y1, int x2, int y2) noexcept;
122  [[nodiscard]] constexpr inline QRect adjusted(int x1, int y1, int x2, int y2) const noexcept;
123 
124  constexpr inline QSize size() const noexcept;
125  constexpr inline int width() const noexcept;
126  constexpr inline int height() const noexcept;
127  constexpr inline void setWidth(int w) noexcept;
128  constexpr inline void setHeight(int h) noexcept;
129  constexpr inline void setSize(const QSize &s) noexcept;
130 
131  QRect operator|(const QRect &r) const noexcept;
132  QRect operator&(const QRect &r) const noexcept;
133  inline QRect &operator|=(const QRect &r) noexcept;
134  inline QRect &operator&=(const QRect &r) noexcept;
135 
136  bool contains(const QRect &r, bool proper = false) const noexcept;
137  bool contains(const QPoint &p, bool proper = false) const noexcept;
138  inline bool contains(int x, int y) const noexcept;
139  inline bool contains(int x, int y, bool proper) const noexcept;
140  [[nodiscard]] inline QRect united(const QRect &other) const noexcept;
141  [[nodiscard]] inline QRect intersected(const QRect &other) const noexcept;
142  bool intersects(const QRect &r) const noexcept;
143 
144  constexpr inline QRect marginsAdded(const QMargins &margins) const noexcept;
145  constexpr inline QRect marginsRemoved(const QMargins &margins) const noexcept;
146  constexpr inline QRect &operator+=(const QMargins &margins) noexcept;
147  constexpr inline QRect &operator-=(const QMargins &margins) noexcept;
148 
149  [[nodiscard]] static constexpr inline QRect span(const QPoint &p1, const QPoint &p2) noexcept;
150 
151  friend constexpr inline bool operator==(const QRect &r1, const QRect &r2) noexcept
152  { return r1.x1==r2.x1 && r1.x2==r2.x2 && r1.y1==r2.y1 && r1.y2==r2.y2; }
153  friend constexpr inline bool operator!=(const QRect &r1, const QRect &r2) noexcept
154  { return r1.x1!=r2.x1 || r1.x2!=r2.x2 || r1.y1!=r2.y1 || r1.y2!=r2.y2; }
155  friend constexpr inline size_t qHash(const QRect &, size_t) noexcept;
156 
157 #if defined(Q_OS_DARWIN) || defined(Q_QDOC)
158  [[nodiscard]] CGRect toCGRect() const noexcept;
159 #endif
160 
161 private:
162  int x1;
163  int y1;
164  int x2;
165  int y2;
166 };
168 
169 
170 /*****************************************************************************
171  QRect stream functions
172  *****************************************************************************/
173 #ifndef QT_NO_DATASTREAM
174 Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QRect &);
175 Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QRect &);
176 #endif
177 
178 /*****************************************************************************
179  QRect inline member functions
180  *****************************************************************************/
181 
182 constexpr inline QRect::QRect(int aleft, int atop, int awidth, int aheight) noexcept
183  : x1(aleft), y1(atop), x2(aleft + awidth - 1), y2(atop + aheight - 1) {}
184 
185 constexpr inline QRect::QRect(const QPoint &atopLeft, const QPoint &abottomRight) noexcept
186  : x1(atopLeft.x()), y1(atopLeft.y()), x2(abottomRight.x()), y2(abottomRight.y()) {}
187 
188 constexpr inline QRect::QRect(const QPoint &atopLeft, const QSize &asize) noexcept
189  : x1(atopLeft.x()), y1(atopLeft.y()), x2(atopLeft.x()+asize.width() - 1), y2(atopLeft.y()+asize.height() - 1) {}
190 
191 constexpr inline bool QRect::isNull() const noexcept
192 { return x2 == x1 - 1 && y2 == y1 - 1; }
193 
194 constexpr inline bool QRect::isEmpty() const noexcept
195 { return x1 > x2 || y1 > y2; }
196 
197 constexpr inline bool QRect::isValid() const noexcept
198 { return x1 <= x2 && y1 <= y2; }
199 
200 constexpr inline int QRect::left() const noexcept
201 { return x1; }
202 
203 constexpr inline int QRect::top() const noexcept
204 { return y1; }
205 
206 constexpr inline int QRect::right() const noexcept
207 { return x2; }
208 
209 constexpr inline int QRect::bottom() const noexcept
210 { return y2; }
211 
212 constexpr inline int QRect::x() const noexcept
213 { return x1; }
214 
215 constexpr inline int QRect::y() const noexcept
216 { return y1; }
217 
218 constexpr inline void QRect::setLeft(int pos) noexcept
219 { x1 = pos; }
220 
221 constexpr inline void QRect::setTop(int pos) noexcept
222 { y1 = pos; }
223 
224 constexpr inline void QRect::setRight(int pos) noexcept
225 { x2 = pos; }
226 
227 constexpr inline void QRect::setBottom(int pos) noexcept
228 { y2 = pos; }
229 
230 constexpr inline void QRect::setTopLeft(const QPoint &p) noexcept
231 { x1 = p.x(); y1 = p.y(); }
232 
233 constexpr inline void QRect::setBottomRight(const QPoint &p) noexcept
234 { x2 = p.x(); y2 = p.y(); }
235 
236 constexpr inline void QRect::setTopRight(const QPoint &p) noexcept
237 { x2 = p.x(); y1 = p.y(); }
238 
239 constexpr inline void QRect::setBottomLeft(const QPoint &p) noexcept
240 { x1 = p.x(); y2 = p.y(); }
241 
242 constexpr inline void QRect::setX(int ax) noexcept
243 { x1 = ax; }
244 
245 constexpr inline void QRect::setY(int ay) noexcept
246 { y1 = ay; }
247 
248 constexpr inline QPoint QRect::topLeft() const noexcept
249 { return QPoint(x1, y1); }
250 
251 constexpr inline QPoint QRect::bottomRight() const noexcept
252 { return QPoint(x2, y2); }
253 
254 constexpr inline QPoint QRect::topRight() const noexcept
255 { return QPoint(x2, y1); }
256 
257 constexpr inline QPoint QRect::bottomLeft() const noexcept
258 { return QPoint(x1, y2); }
259 
260 constexpr inline QPoint QRect::center() const noexcept
261 { return QPoint(int((qint64(x1)+x2)/2), int((qint64(y1)+y2)/2)); } // cast avoids overflow on addition
262 
263 constexpr inline int QRect::width() const noexcept
264 { return x2 - x1 + 1; }
265 
266 constexpr inline int QRect::height() const noexcept
267 { return y2 - y1 + 1; }
268 
269 constexpr inline QSize QRect::size() const noexcept
270 { return QSize(width(), height()); }
271 
272 constexpr inline void QRect::translate(int dx, int dy) noexcept
273 {
274  x1 += dx;
275  y1 += dy;
276  x2 += dx;
277  y2 += dy;
278 }
279 
280 constexpr inline void QRect::translate(const QPoint &p) noexcept
281 {
282  x1 += p.x();
283  y1 += p.y();
284  x2 += p.x();
285  y2 += p.y();
286 }
287 
288 constexpr inline QRect QRect::translated(int dx, int dy) const noexcept
289 { return QRect(QPoint(x1 + dx, y1 + dy), QPoint(x2 + dx, y2 + dy)); }
290 
291 constexpr inline QRect QRect::translated(const QPoint &p) const noexcept
292 { return QRect(QPoint(x1 + p.x(), y1 + p.y()), QPoint(x2 + p.x(), y2 + p.y())); }
293 
294 constexpr inline QRect QRect::transposed() const noexcept
295 { return QRect(topLeft(), size().transposed()); }
296 
297 constexpr inline void QRect::moveTo(int ax, int ay) noexcept
298 {
299  x2 += ax - x1;
300  y2 += ay - y1;
301  x1 = ax;
302  y1 = ay;
303 }
304 
305 constexpr inline void QRect::moveTo(const QPoint &p) noexcept
306 {
307  x2 += p.x() - x1;
308  y2 += p.y() - y1;
309  x1 = p.x();
310  y1 = p.y();
311 }
312 
313 constexpr inline void QRect::moveLeft(int pos) noexcept
314 { x2 += (pos - x1); x1 = pos; }
315 
316 constexpr inline void QRect::moveTop(int pos) noexcept
317 { y2 += (pos - y1); y1 = pos; }
318 
319 constexpr inline void QRect::moveRight(int pos) noexcept
320 {
321  x1 += (pos - x2);
322  x2 = pos;
323 }
324 
325 constexpr inline void QRect::moveBottom(int pos) noexcept
326 {
327  y1 += (pos - y2);
328  y2 = pos;
329 }
330 
331 constexpr inline void QRect::moveTopLeft(const QPoint &p) noexcept
332 {
333  moveLeft(p.x());
334  moveTop(p.y());
335 }
336 
337 constexpr inline void QRect::moveBottomRight(const QPoint &p) noexcept
338 {
339  moveRight(p.x());
340  moveBottom(p.y());
341 }
342 
343 constexpr inline void QRect::moveTopRight(const QPoint &p) noexcept
344 {
345  moveRight(p.x());
346  moveTop(p.y());
347 }
348 
349 constexpr inline void QRect::moveBottomLeft(const QPoint &p) noexcept
350 {
351  moveLeft(p.x());
352  moveBottom(p.y());
353 }
354 
355 constexpr inline void QRect::moveCenter(const QPoint &p) noexcept
356 {
357  int w = x2 - x1;
358  int h = y2 - y1;
359  x1 = p.x() - w/2;
360  y1 = p.y() - h/2;
361  x2 = x1 + w;
362  y2 = y1 + h;
363 }
364 
365 constexpr inline void QRect::getRect(int *ax, int *ay, int *aw, int *ah) const
366 {
367  *ax = x1;
368  *ay = y1;
369  *aw = x2 - x1 + 1;
370  *ah = y2 - y1 + 1;
371 }
372 
373 constexpr inline void QRect::setRect(int ax, int ay, int aw, int ah) noexcept
374 {
375  x1 = ax;
376  y1 = ay;
377  x2 = (ax + aw - 1);
378  y2 = (ay + ah - 1);
379 }
380 
381 constexpr inline void QRect::getCoords(int *xp1, int *yp1, int *xp2, int *yp2) const
382 {
383  *xp1 = x1;
384  *yp1 = y1;
385  *xp2 = x2;
386  *yp2 = y2;
387 }
388 
389 constexpr inline void QRect::setCoords(int xp1, int yp1, int xp2, int yp2) noexcept
390 {
391  x1 = xp1;
392  y1 = yp1;
393  x2 = xp2;
394  y2 = yp2;
395 }
396 
397 constexpr inline QRect QRect::adjusted(int xp1, int yp1, int xp2, int yp2) const noexcept
398 { return QRect(QPoint(x1 + xp1, y1 + yp1), QPoint(x2 + xp2, y2 + yp2)); }
399 
400 constexpr inline void QRect::adjust(int dx1, int dy1, int dx2, int dy2) noexcept
401 {
402  x1 += dx1;
403  y1 += dy1;
404  x2 += dx2;
405  y2 += dy2;
406 }
407 
408 constexpr inline void QRect::setWidth(int w) noexcept
409 { x2 = (x1 + w - 1); }
410 
411 constexpr inline void QRect::setHeight(int h) noexcept
412 { y2 = (y1 + h - 1); }
413 
414 constexpr inline void QRect::setSize(const QSize &s) noexcept
415 {
416  x2 = (s.width() + x1 - 1);
417  y2 = (s.height() + y1 - 1);
418 }
419 
420 inline bool QRect::contains(int ax, int ay, bool aproper) const noexcept
421 {
422  return contains(QPoint(ax, ay), aproper);
423 }
424 
425 inline bool QRect::contains(int ax, int ay) const noexcept
426 {
427  return contains(QPoint(ax, ay), false);
428 }
429 
430 inline QRect &QRect::operator|=(const QRect &r) noexcept
431 {
432  *this = *this | r;
433  return *this;
434 }
435 
436 inline QRect &QRect::operator&=(const QRect &r) noexcept
437 {
438  *this = *this & r;
439  return *this;
440 }
441 
442 inline QRect QRect::intersected(const QRect &other) const noexcept
443 {
444  return *this & other;
445 }
446 
447 inline QRect QRect::united(const QRect &r) const noexcept
448 {
449  return *this | r;
450 }
451 
452 constexpr inline size_t qHash(const QRect &r, size_t seed = 0) noexcept
453 {
454  return qHashMulti(seed, r.x1, r.x2, r.y1, r.y2);
455 }
456 
457 constexpr inline QRect operator+(const QRect &rectangle, const QMargins &margins) noexcept
458 {
459  return QRect(QPoint(rectangle.left() - margins.left(), rectangle.top() - margins.top()),
460  QPoint(rectangle.right() + margins.right(), rectangle.bottom() + margins.bottom()));
461 }
462 
463 constexpr inline QRect operator+(const QMargins &margins, const QRect &rectangle) noexcept
464 {
465  return QRect(QPoint(rectangle.left() - margins.left(), rectangle.top() - margins.top()),
466  QPoint(rectangle.right() + margins.right(), rectangle.bottom() + margins.bottom()));
467 }
468 
469 constexpr inline QRect operator-(const QRect &lhs, const QMargins &rhs) noexcept
470 {
471  return QRect(QPoint(lhs.left() + rhs.left(), lhs.top() + rhs.top()),
472  QPoint(lhs.right() - rhs.right(), lhs.bottom() - rhs.bottom()));
473 }
474 
475 constexpr inline QRect QRect::marginsAdded(const QMargins &margins) const noexcept
476 {
477  return QRect(QPoint(x1 - margins.left(), y1 - margins.top()),
478  QPoint(x2 + margins.right(), y2 + margins.bottom()));
479 }
480 
481 constexpr inline QRect QRect::marginsRemoved(const QMargins &margins) const noexcept
482 {
483  return QRect(QPoint(x1 + margins.left(), y1 + margins.top()),
484  QPoint(x2 - margins.right(), y2 - margins.bottom()));
485 }
486 
487 constexpr inline QRect &QRect::operator+=(const QMargins &margins) noexcept
488 {
489  *this = marginsAdded(margins);
490  return *this;
491 }
492 
493 constexpr inline QRect &QRect::operator-=(const QMargins &margins) noexcept
494 {
495  *this = marginsRemoved(margins);
496  return *this;
497 }
498 
499 constexpr QRect QRect::span(const QPoint &p1, const QPoint &p2) noexcept
500 {
501  return QRect(QPoint(qMin(p1.x(), p2.x()), qMin(p1.y(), p2.y())),
502  QPoint(qMax(p1.x(), p2.x()), qMax(p1.y(), p2.y())));
503 }
504 
505 #ifndef QT_NO_DEBUG_STREAM
506 Q_CORE_EXPORT QDebug operator<<(QDebug, const QRect &);
507 #endif
508 
509 
510 class Q_CORE_EXPORT QRectF
511 {
512 public:
513  constexpr QRectF() noexcept : xp(0.), yp(0.), w(0.), h(0.) {}
514  constexpr QRectF(const QPointF &topleft, const QSizeF &size) noexcept;
515  constexpr QRectF(const QPointF &topleft, const QPointF &bottomRight) noexcept;
516  constexpr QRectF(qreal left, qreal top, qreal width, qreal height) noexcept;
517  constexpr QRectF(const QRect &rect) noexcept;
518 
519  constexpr inline bool isNull() const noexcept;
520  constexpr inline bool isEmpty() const noexcept;
521  constexpr inline bool isValid() const noexcept;
522  [[nodiscard]] QRectF normalized() const noexcept;
523 
524  constexpr inline qreal left() const noexcept { return xp; }
525  constexpr inline qreal top() const noexcept { return yp; }
526  constexpr inline qreal right() const noexcept { return xp + w; }
527  constexpr inline qreal bottom() const noexcept { return yp + h; }
528 
529  constexpr inline qreal x() const noexcept;
530  constexpr inline qreal y() const noexcept;
531  constexpr inline void setLeft(qreal pos) noexcept;
532  constexpr inline void setTop(qreal pos) noexcept;
533  constexpr inline void setRight(qreal pos) noexcept;
534  constexpr inline void setBottom(qreal pos) noexcept;
535  constexpr inline void setX(qreal pos) noexcept { setLeft(pos); }
536  constexpr inline void setY(qreal pos) noexcept { setTop(pos); }
537 
538  constexpr inline QPointF topLeft() const noexcept { return QPointF(xp, yp); }
539  constexpr inline QPointF bottomRight() const noexcept { return QPointF(xp+w, yp+h); }
540  constexpr inline QPointF topRight() const noexcept { return QPointF(xp+w, yp); }
541  constexpr inline QPointF bottomLeft() const noexcept { return QPointF(xp, yp+h); }
542  constexpr inline QPointF center() const noexcept;
543 
544  constexpr inline void setTopLeft(const QPointF &p) noexcept;
545  constexpr inline void setBottomRight(const QPointF &p) noexcept;
546  constexpr inline void setTopRight(const QPointF &p) noexcept;
547  constexpr inline void setBottomLeft(const QPointF &p) noexcept;
548 
549  constexpr inline void moveLeft(qreal pos) noexcept;
550  constexpr inline void moveTop(qreal pos) noexcept;
551  constexpr inline void moveRight(qreal pos) noexcept;
552  constexpr inline void moveBottom(qreal pos) noexcept;
553  constexpr inline void moveTopLeft(const QPointF &p) noexcept;
554  constexpr inline void moveBottomRight(const QPointF &p) noexcept;
555  constexpr inline void moveTopRight(const QPointF &p) noexcept;
556  constexpr inline void moveBottomLeft(const QPointF &p) noexcept;
557  constexpr inline void moveCenter(const QPointF &p) noexcept;
558 
559  constexpr inline void translate(qreal dx, qreal dy) noexcept;
560  constexpr inline void translate(const QPointF &p) noexcept;
561 
562  [[nodiscard]] constexpr inline QRectF translated(qreal dx, qreal dy) const noexcept;
563  [[nodiscard]] constexpr inline QRectF translated(const QPointF &p) const noexcept;
564 
565  [[nodiscard]] constexpr inline QRectF transposed() const noexcept;
566 
567  constexpr inline void moveTo(qreal x, qreal y) noexcept;
568  constexpr inline void moveTo(const QPointF &p) noexcept;
569 
570  constexpr inline void setRect(qreal x, qreal y, qreal w, qreal h) noexcept;
571  constexpr inline void getRect(qreal *x, qreal *y, qreal *w, qreal *h) const;
572 
573  constexpr inline void setCoords(qreal x1, qreal y1, qreal x2, qreal y2) noexcept;
574  constexpr inline void getCoords(qreal *x1, qreal *y1, qreal *x2, qreal *y2) const;
575 
576  constexpr inline void adjust(qreal x1, qreal y1, qreal x2, qreal y2) noexcept;
577  [[nodiscard]] constexpr inline QRectF adjusted(qreal x1, qreal y1, qreal x2, qreal y2) const noexcept;
578 
579  constexpr inline QSizeF size() const noexcept;
580  constexpr inline qreal width() const noexcept;
581  constexpr inline qreal height() const noexcept;
582  constexpr inline void setWidth(qreal w) noexcept;
583  constexpr inline void setHeight(qreal h) noexcept;
584  constexpr inline void setSize(const QSizeF &s) noexcept;
585 
586  QRectF operator|(const QRectF &r) const noexcept;
587  QRectF operator&(const QRectF &r) const noexcept;
588  inline QRectF &operator|=(const QRectF &r) noexcept;
589  inline QRectF &operator&=(const QRectF &r) noexcept;
590 
591  bool contains(const QRectF &r) const noexcept;
592  bool contains(const QPointF &p) const noexcept;
593  inline bool contains(qreal x, qreal y) const noexcept;
594  [[nodiscard]] inline QRectF united(const QRectF &other) const noexcept;
595  [[nodiscard]] inline QRectF intersected(const QRectF &other) const noexcept;
596  bool intersects(const QRectF &r) const noexcept;
597 
598  constexpr inline QRectF marginsAdded(const QMarginsF &margins) const noexcept;
599  constexpr inline QRectF marginsRemoved(const QMarginsF &margins) const noexcept;
600  constexpr inline QRectF &operator+=(const QMarginsF &margins) noexcept;
601  constexpr inline QRectF &operator-=(const QMarginsF &margins) noexcept;
602 
603  friend constexpr inline bool operator==(const QRectF &r1, const QRectF &r2) noexcept
604  {
605  return r1.topLeft() == r2.topLeft()
606  && r1.size() == r2.size();
607  }
608  friend constexpr inline bool operator!=(const QRectF &r1, const QRectF &r2) noexcept
609  {
610  return r1.topLeft() != r2.topLeft()
611  || r1.size() != r2.size();
612  }
613 
614  [[nodiscard]] constexpr inline QRect toRect() const noexcept;
615  [[nodiscard]] QRect toAlignedRect() const noexcept;
616 
617 #if defined(Q_OS_DARWIN) || defined(Q_QDOC)
618  [[nodiscard]] static QRectF fromCGRect(CGRect rect) noexcept;
619  [[nodiscard]] CGRect toCGRect() const noexcept;
620 #endif
621 
622 private:
623  qreal xp;
624  qreal yp;
625  qreal w;
626  qreal h;
627 };
629 
630 
631 /*****************************************************************************
632  QRectF stream functions
633  *****************************************************************************/
634 #ifndef QT_NO_DATASTREAM
635 Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QRectF &);
636 Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QRectF &);
637 #endif
638 
639 /*****************************************************************************
640  QRectF inline member functions
641  *****************************************************************************/
642 
643 constexpr inline QRectF::QRectF(qreal aleft, qreal atop, qreal awidth, qreal aheight) noexcept
644  : xp(aleft), yp(atop), w(awidth), h(aheight)
645 {
646 }
647 
648 constexpr inline QRectF::QRectF(const QPointF &atopLeft, const QSizeF &asize) noexcept
649  : xp(atopLeft.x()), yp(atopLeft.y()), w(asize.width()), h(asize.height())
650 {
651 }
652 
653 
654 constexpr inline QRectF::QRectF(const QPointF &atopLeft, const QPointF &abottomRight) noexcept
655  : xp(atopLeft.x()), yp(atopLeft.y()), w(abottomRight.x() - atopLeft.x()), h(abottomRight.y() - atopLeft.y())
656 {
657 }
658 
659 constexpr inline QRectF::QRectF(const QRect &r) noexcept
660  : xp(r.x()), yp(r.y()), w(r.width()), h(r.height())
661 {
662 }
663 
666 
667 constexpr inline bool QRectF::isNull() const noexcept
668 { return w == 0. && h == 0.; }
669 
670 constexpr inline bool QRectF::isEmpty() const noexcept
671 { return w <= 0. || h <= 0.; }
672 
674 
675 constexpr inline bool QRectF::isValid() const noexcept
676 { return w > 0. && h > 0.; }
677 
678 constexpr inline qreal QRectF::x() const noexcept
679 { return xp; }
680 
681 constexpr inline qreal QRectF::y() const noexcept
682 { return yp; }
683 
684 constexpr inline void QRectF::setLeft(qreal pos) noexcept
685 { qreal diff = pos - xp; xp += diff; w -= diff; }
686 
687 constexpr inline void QRectF::setRight(qreal pos) noexcept
688 { w = pos - xp; }
689 
690 constexpr inline void QRectF::setTop(qreal pos) noexcept
691 { qreal diff = pos - yp; yp += diff; h -= diff; }
692 
693 constexpr inline void QRectF::setBottom(qreal pos) noexcept
694 { h = pos - yp; }
695 
696 constexpr inline void QRectF::setTopLeft(const QPointF &p) noexcept
697 { setLeft(p.x()); setTop(p.y()); }
698 
699 constexpr inline void QRectF::setTopRight(const QPointF &p) noexcept
700 { setRight(p.x()); setTop(p.y()); }
701 
702 constexpr inline void QRectF::setBottomLeft(const QPointF &p) noexcept
703 { setLeft(p.x()); setBottom(p.y()); }
704 
705 constexpr inline void QRectF::setBottomRight(const QPointF &p) noexcept
706 { setRight(p.x()); setBottom(p.y()); }
707 
708 constexpr inline QPointF QRectF::center() const noexcept
709 { return QPointF(xp + w/2, yp + h/2); }
710 
711 constexpr inline void QRectF::moveLeft(qreal pos) noexcept
712 { xp = pos; }
713 
714 constexpr inline void QRectF::moveTop(qreal pos) noexcept
715 { yp = pos; }
716 
717 constexpr inline void QRectF::moveRight(qreal pos) noexcept
718 { xp = pos - w; }
719 
720 constexpr inline void QRectF::moveBottom(qreal pos) noexcept
721 { yp = pos - h; }
722 
723 constexpr inline void QRectF::moveTopLeft(const QPointF &p) noexcept
724 { moveLeft(p.x()); moveTop(p.y()); }
725 
726 constexpr inline void QRectF::moveTopRight(const QPointF &p) noexcept
727 { moveRight(p.x()); moveTop(p.y()); }
728 
729 constexpr inline void QRectF::moveBottomLeft(const QPointF &p) noexcept
730 { moveLeft(p.x()); moveBottom(p.y()); }
731 
732 constexpr inline void QRectF::moveBottomRight(const QPointF &p) noexcept
733 { moveRight(p.x()); moveBottom(p.y()); }
734 
735 constexpr inline void QRectF::moveCenter(const QPointF &p) noexcept
736 { xp = p.x() - w/2; yp = p.y() - h/2; }
737 
738 constexpr inline qreal QRectF::width() const noexcept
739 { return w; }
740 
741 constexpr inline qreal QRectF::height() const noexcept
742 { return h; }
743 
744 constexpr inline QSizeF QRectF::size() const noexcept
745 { return QSizeF(w, h); }
746 
747 constexpr inline void QRectF::translate(qreal dx, qreal dy) noexcept
748 {
749  xp += dx;
750  yp += dy;
751 }
752 
753 constexpr inline void QRectF::translate(const QPointF &p) noexcept
754 {
755  xp += p.x();
756  yp += p.y();
757 }
758 
759 constexpr inline void QRectF::moveTo(qreal ax, qreal ay) noexcept
760 {
761  xp = ax;
762  yp = ay;
763 }
764 
765 constexpr inline void QRectF::moveTo(const QPointF &p) noexcept
766 {
767  xp = p.x();
768  yp = p.y();
769 }
770 
771 constexpr inline QRectF QRectF::translated(qreal dx, qreal dy) const noexcept
772 {
773  return QRectF(xp + dx, yp + dy, w, h);
774 }
775 
776 constexpr inline QRectF QRectF::translated(const QPointF &p) const noexcept
777 { return QRectF(xp + p.x(), yp + p.y(), w, h); }
778 
779 constexpr inline QRectF QRectF::transposed() const noexcept
780 { return QRectF(topLeft(), size().transposed()); }
781 
782 constexpr inline void QRectF::getRect(qreal *ax, qreal *ay, qreal *aaw, qreal *aah) const
783 {
784  *ax = this->xp;
785  *ay = this->yp;
786  *aaw = this->w;
787  *aah = this->h;
788 }
789 
790 constexpr inline void QRectF::setRect(qreal ax, qreal ay, qreal aaw, qreal aah) noexcept
791 {
792  this->xp = ax;
793  this->yp = ay;
794  this->w = aaw;
795  this->h = aah;
796 }
797 
798 constexpr inline void QRectF::getCoords(qreal *xp1, qreal *yp1, qreal *xp2, qreal *yp2) const
799 {
800  *xp1 = xp;
801  *yp1 = yp;
802  *xp2 = xp + w;
803  *yp2 = yp + h;
804 }
805 
806 constexpr inline void QRectF::setCoords(qreal xp1, qreal yp1, qreal xp2, qreal yp2) noexcept
807 {
808  xp = xp1;
809  yp = yp1;
810  w = xp2 - xp1;
811  h = yp2 - yp1;
812 }
813 
814 constexpr inline void QRectF::adjust(qreal xp1, qreal yp1, qreal xp2, qreal yp2) noexcept
815 {
816  xp += xp1;
817  yp += yp1;
818  w += xp2 - xp1;
819  h += yp2 - yp1;
820 }
821 
822 constexpr inline QRectF QRectF::adjusted(qreal xp1, qreal yp1, qreal xp2, qreal yp2) const noexcept
823 {
824  return QRectF(xp + xp1, yp + yp1, w + xp2 - xp1, h + yp2 - yp1);
825 }
826 
827 constexpr inline void QRectF::setWidth(qreal aw) noexcept
828 { this->w = aw; }
829 
830 constexpr inline void QRectF::setHeight(qreal ah) noexcept
831 { this->h = ah; }
832 
833 constexpr inline void QRectF::setSize(const QSizeF &s) noexcept
834 {
835  w = s.width();
836  h = s.height();
837 }
838 
839 inline bool QRectF::contains(qreal ax, qreal ay) const noexcept
840 {
841  return contains(QPointF(ax, ay));
842 }
843 
844 inline QRectF &QRectF::operator|=(const QRectF &r) noexcept
845 {
846  *this = *this | r;
847  return *this;
848 }
849 
850 inline QRectF &QRectF::operator&=(const QRectF &r) noexcept
851 {
852  *this = *this & r;
853  return *this;
854 }
855 
856 inline QRectF QRectF::intersected(const QRectF &r) const noexcept
857 {
858  return *this & r;
859 }
860 
861 inline QRectF QRectF::united(const QRectF &r) const noexcept
862 {
863  return *this | r;
864 }
865 
866 constexpr inline QRect QRectF::toRect() const noexcept
867 {
868  // This rounding is designed to minimize the maximum possible difference
869  // in topLeft(), bottomRight(), and size() after rounding.
870  // All dimensions are at most off by 0.75, and topLeft by at most 0.5.
871  const int nxp = qRound(xp);
872  const int nyp = qRound(yp);
873  const int nw = qRound(w + (xp - nxp) / 2);
874  const int nh = qRound(h + (yp - nyp) / 2);
875  return QRect(nxp, nyp, nw, nh);
876 }
877 
878 constexpr inline QRectF operator+(const QRectF &lhs, const QMarginsF &rhs) noexcept
879 {
880  return QRectF(QPointF(lhs.left() - rhs.left(), lhs.top() - rhs.top()),
881  QSizeF(lhs.width() + rhs.left() + rhs.right(), lhs.height() + rhs.top() + rhs.bottom()));
882 }
883 
884 constexpr inline QRectF operator+(const QMarginsF &lhs, const QRectF &rhs) noexcept
885 {
886  return QRectF(QPointF(rhs.left() - lhs.left(), rhs.top() - lhs.top()),
887  QSizeF(rhs.width() + lhs.left() + lhs.right(), rhs.height() + lhs.top() + lhs.bottom()));
888 }
889 
890 constexpr inline QRectF operator-(const QRectF &lhs, const QMarginsF &rhs) noexcept
891 {
892  return QRectF(QPointF(lhs.left() + rhs.left(), lhs.top() + rhs.top()),
893  QSizeF(lhs.width() - rhs.left() - rhs.right(), lhs.height() - rhs.top() - rhs.bottom()));
894 }
895 
896 constexpr inline QRectF QRectF::marginsAdded(const QMarginsF &margins) const noexcept
897 {
898  return QRectF(QPointF(xp - margins.left(), yp - margins.top()),
899  QSizeF(w + margins.left() + margins.right(), h + margins.top() + margins.bottom()));
900 }
901 
902 constexpr inline QRectF QRectF::marginsRemoved(const QMarginsF &margins) const noexcept
903 {
904  return QRectF(QPointF(xp + margins.left(), yp + margins.top()),
905  QSizeF(w - margins.left() - margins.right(), h - margins.top() - margins.bottom()));
906 }
907 
908 constexpr inline QRectF &QRectF::operator+=(const QMarginsF &margins) noexcept
909 {
910  *this = marginsAdded(margins);
911  return *this;
912 }
913 
914 constexpr inline QRectF &QRectF::operator-=(const QMarginsF &margins) noexcept
915 {
916  *this = marginsRemoved(margins);
917  return *this;
918 }
919 
920 #ifndef QT_NO_DEBUG_STREAM
921 Q_CORE_EXPORT QDebug operator<<(QDebug, const QRectF &);
922 #endif
923 
925 
926 #endif // QRECT_H
const QByteArray operator+(const QByteArray &a1, const QByteArray &a2)
Definition: qbytearray.h:575
The QDataStream class provides serialization of binary data to a QIODevice.
Definition: qdatastream.h:66
operator>>(QDataStream &ds, qfloat16 &f)
Definition: qfloat16.cpp:344
operator<<(QDataStream &ds, qfloat16 f)
Definition: qfloat16.cpp:327
The QDebug class provides an output stream for debugging information.
Definition: qdebug.h:65
template< typename Enum > size_t qHash(QFlags< Enum > flags, size_t seed=0) noexcept
template< typename... T > size_t qHashMulti(size_t seed, const T &...args)
The QMarginsF class defines the four margins of a rectangle.
Definition: qmargins.h:301
The QMargins class defines the four margins of a rectangle.
Definition: qmargins.h:52
QMargins operator-(const QMargins &m1, const QMargins &m2)
Definition: qmargins.h:168
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:242
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:52
The QRectF class defines a finite rectangle in the plane using floating point precision.
Definition: qrect.h:511
constexpr friend bool operator!=(const QRectF &r1, const QRectF &r2) noexcept
Definition: qrect.h:608
constexpr void moveCenter(const QPointF &p) noexcept
Definition: qrect.h:735
constexpr bool isEmpty() const noexcept
Definition: qrect.h:670
constexpr void moveTo(qreal x, qreal y) noexcept
Definition: qrect.h:759
constexpr qreal bottom() const noexcept
Definition: qrect.h:527
constexpr void getCoords(qreal *x1, qreal *y1, qreal *x2, qreal *y2) const
Definition: qrect.h:798
constexpr void setBottom(qreal pos) noexcept
Definition: qrect.h:693
constexpr void setRight(qreal pos) noexcept
Definition: qrect.h:687
constexpr void getRect(qreal *x, qreal *y, qreal *w, qreal *h) const
Definition: qrect.h:782
constexpr void setLeft(qreal pos) noexcept
Definition: qrect.h:684
constexpr qreal y() const noexcept
Definition: qrect.h:681
constexpr void setCoords(qreal x1, qreal y1, qreal x2, qreal y2) noexcept
Definition: qrect.h:806
constexpr qreal height() const noexcept
Definition: qrect.h:741
constexpr qreal width() const noexcept
Definition: qrect.h:738
constexpr qreal x() const noexcept
Definition: qrect.h:678
QRectF & operator&=(const QRectF &r) noexcept
Definition: qrect.h:850
constexpr QRectF marginsRemoved(const QMarginsF &margins) const noexcept
Definition: qrect.h:902
constexpr QRectF translated(qreal dx, qreal dy) const noexcept
Definition: qrect.h:771
constexpr QRectF & operator+=(const QMarginsF &margins) noexcept
Definition: qrect.h:908
constexpr void setTopLeft(const QPointF &p) noexcept
Definition: qrect.h:696
constexpr void setTop(qreal pos) noexcept
Definition: qrect.h:690
bool contains(const QRectF &r) const noexcept
Definition: qrect.cpp:2006
constexpr QRectF & operator-=(const QMarginsF &margins) noexcept
Definition: qrect.h:914
constexpr QPointF bottomLeft() const noexcept
Definition: qrect.h:541
constexpr QRectF() noexcept
Definition: qrect.h:513
constexpr void moveRight(qreal pos) noexcept
Definition: qrect.h:717
constexpr void setY(qreal pos) noexcept
Definition: qrect.h:536
constexpr void moveTopLeft(const QPointF &p) noexcept
Definition: qrect.h:723
constexpr QRectF marginsAdded(const QMarginsF &margins) const noexcept
Definition: qrect.h:896
constexpr QRectF adjusted(qreal x1, qreal y1, qreal x2, qreal y2) const noexcept
Definition: qrect.h:822
constexpr void setBottomLeft(const QPointF &p) noexcept
Definition: qrect.h:702
constexpr void moveBottomLeft(const QPointF &p) noexcept
Definition: qrect.h:729
constexpr void setWidth(qreal w) noexcept
Definition: qrect.h:827
constexpr void moveBottom(qreal pos) noexcept
Definition: qrect.h:720
constexpr void setBottomRight(const QPointF &p) noexcept
Definition: qrect.h:705
constexpr void setSize(const QSizeF &s) noexcept
Definition: qrect.h:833
constexpr bool isNull() const noexcept
Definition: qrect.h:667
constexpr void moveBottomRight(const QPointF &p) noexcept
Definition: qrect.h:732
constexpr QPointF topLeft() const noexcept
Definition: qrect.h:538
constexpr QPointF center() const noexcept
Definition: qrect.h:708
constexpr bool isValid() const noexcept
Definition: qrect.h:675
constexpr void moveLeft(qreal pos) noexcept
Definition: qrect.h:711
constexpr QPointF bottomRight() const noexcept
Definition: qrect.h:539
constexpr QSizeF size() const noexcept
Definition: qrect.h:744
constexpr QRect toRect() const noexcept
Definition: qrect.h:866
constexpr void adjust(qreal x1, qreal y1, qreal x2, qreal y2) noexcept
Definition: qrect.h:814
constexpr void translate(qreal dx, qreal dy) noexcept
Definition: qrect.h:747
constexpr qreal top() const noexcept
Definition: qrect.h:525
constexpr void setHeight(qreal h) noexcept
Definition: qrect.h:830
constexpr void moveTop(qreal pos) noexcept
Definition: qrect.h:714
constexpr void setTopRight(const QPointF &p) noexcept
Definition: qrect.h:699
constexpr QPointF topRight() const noexcept
Definition: qrect.h:540
QRectF & operator|=(const QRectF &r) noexcept
Definition: qrect.h:844
constexpr QRectF transposed() const noexcept
Definition: qrect.h:779
QRectF intersected(const QRectF &other) const noexcept
Definition: qrect.h:856
constexpr void moveTopRight(const QPointF &p) noexcept
Definition: qrect.h:726
QRectF united(const QRectF &other) const noexcept
Definition: qrect.h:861
constexpr qreal right() const noexcept
Definition: qrect.h:526
constexpr void setRect(qreal x, qreal y, qreal w, qreal h) noexcept
Definition: qrect.h:790
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:59
constexpr void moveBottomRight(const QPoint &p) noexcept
Definition: qrect.h:337
constexpr QRect & operator+=(const QMargins &margins) noexcept
Definition: qrect.h:487
constexpr QPoint bottomLeft() const noexcept
Definition: qrect.h:257
constexpr void setBottomLeft(const QPoint &p) noexcept
Definition: qrect.h:239
constexpr bool isEmpty() const noexcept
Definition: qrect.h:194
constexpr void getCoords(int *x1, int *y1, int *x2, int *y2) const
Definition: qrect.h:381
constexpr void moveTopLeft(const QPoint &p) noexcept
Definition: qrect.h:331
constexpr QRect marginsAdded(const QMargins &margins) const noexcept
Definition: qrect.h:475
constexpr void adjust(int x1, int y1, int x2, int y2) noexcept
Definition: qrect.h:400
constexpr void moveBottom(int pos) noexcept
Definition: qrect.h:325
constexpr void moveRight(int pos) noexcept
Definition: qrect.h:319
constexpr void moveCenter(const QPoint &p) noexcept
Definition: qrect.h:355
constexpr QRect & operator-=(const QMargins &margins) noexcept
Definition: qrect.h:493
constexpr void getRect(int *x, int *y, int *w, int *h) const
Definition: qrect.h:365
constexpr int height() const noexcept
Definition: qrect.h:266
constexpr bool isValid() const noexcept
Definition: qrect.h:197
constexpr bool isNull() const noexcept
Definition: qrect.h:191
QRect intersected(const QRect &other) const noexcept
Definition: qrect.h:442
constexpr int bottom() const noexcept
Definition: qrect.h:209
constexpr QRect marginsRemoved(const QMargins &margins) const noexcept
Definition: qrect.h:481
constexpr void setRight(int pos) noexcept
Definition: qrect.h:224
constexpr QPoint topLeft() const noexcept
Definition: qrect.h:248
constexpr void setSize(const QSize &s) noexcept
Definition: qrect.h:414
constexpr QRect adjusted(int x1, int y1, int x2, int y2) const noexcept
Definition: qrect.h:397
constexpr int top() const noexcept
Definition: qrect.h:203
constexpr QPoint topRight() const noexcept
Definition: qrect.h:254
constexpr void moveLeft(int pos) noexcept
Definition: qrect.h:313
constexpr void setBottom(int pos) noexcept
Definition: qrect.h:227
bool contains(const QRect &r, bool proper=false) const noexcept
Definition: qrect.cpp:887
static constexpr QRect span(const QPoint &p1, const QPoint &p2) noexcept
Definition: qrect.h:499
constexpr void setLeft(int pos) noexcept
Definition: qrect.h:218
constexpr int left() const noexcept
Definition: qrect.h:200
constexpr void setRect(int x, int y, int w, int h) noexcept
Definition: qrect.h:373
constexpr int x() const noexcept
Definition: qrect.h:212
QRect & operator&=(const QRect &r) noexcept
Definition: qrect.h:436
constexpr void setWidth(int w) noexcept
Definition: qrect.h:408
constexpr QRect() noexcept
Definition: qrect.h:61
constexpr void setX(int x) noexcept
Definition: qrect.h:242
constexpr void moveBottomLeft(const QPoint &p) noexcept
Definition: qrect.h:349
constexpr QSize size() const noexcept
Definition: qrect.h:269
constexpr void setTopLeft(const QPoint &p) noexcept
Definition: qrect.h:230
constexpr QRect transposed() const noexcept
Definition: qrect.h:294
constexpr void translate(int dx, int dy) noexcept
Definition: qrect.h:272
constexpr void setCoords(int x1, int y1, int x2, int y2) noexcept
Definition: qrect.h:389
constexpr QPoint bottomRight() const noexcept
Definition: qrect.h:251
constexpr int width() const noexcept
Definition: qrect.h:263
constexpr QRect translated(int dx, int dy) const noexcept
Definition: qrect.h:288
QRect united(const QRect &other) const noexcept
Definition: qrect.h:447
constexpr int y() const noexcept
Definition: qrect.h:215
constexpr void moveTopRight(const QPoint &p) noexcept
Definition: qrect.h:343
constexpr friend bool operator!=(const QRect &r1, const QRect &r2) noexcept
Definition: qrect.h:153
constexpr void setHeight(int h) noexcept
Definition: qrect.h:411
constexpr void moveTo(int x, int t) noexcept
Definition: qrect.h:297
constexpr void setBottomRight(const QPoint &p) noexcept
Definition: qrect.h:233
constexpr void moveTop(int pos) noexcept
Definition: qrect.h:316
QRect & operator|=(const QRect &r) noexcept
Definition: qrect.h:430
constexpr QPoint center() const noexcept
Definition: qrect.h:260
constexpr void setY(int y) noexcept
Definition: qrect.h:245
constexpr void setTopRight(const QPoint &p) noexcept
Definition: qrect.h:236
constexpr int right() const noexcept
Definition: qrect.h:206
constexpr void setTop(int pos) noexcept
Definition: qrect.h:221
The QSizeF class defines the size of a two-dimensional object using floating point precision.
Definition: qsize.h:235
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:55
QPixmap p2
QPixmap p1
[0]
set contains("Julia")
rect
[4]
auto it unsigned count const
Definition: hb-iter.hh:848
#define inline
Definition: md4c.c:45
QTextStream & center(QTextStream &stream)
#define QT_WARNING_POP
#define QT_WARNING_DISABLE_FLOAT_COMPARE
#define QT_WARNING_PUSH
int qRound(qfloat16 d) noexcept
Definition: qfloat16.h:227
QT_END_INCLUDE_NAMESPACE typedef double qreal
Definition: qglobal.h:341
long long qint64
Definition: qglobal.h:298
GLint GLint GLint GLint GLint x
[0]
GLboolean r
[2]
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei height
GLuint GLfloat GLfloat GLfloat GLfloat y1
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint GLfloat GLfloat GLfloat x1
GLdouble GLdouble GLdouble GLdouble top
GLdouble GLdouble right
GLint GLsizei width
GLint left
GLint GLint bottom
GLint y
GLfloat GLfloat GLfloat GLfloat h
GLfixed GLfixed GLfixed y2
Definition: qopenglext.h:5231
GLfixed GLfixed x2
Definition: qopenglext.h:5231
GLdouble GLdouble t
[9]
Definition: qopenglext.h:243
GLenum GLenum GLsizei void GLsizei void void * span
Definition: qopenglext.h:2747
GLint GLenum GLboolean normalized
Definition: qopenglext.h:752
GLdouble s
[6]
Definition: qopenglext.h:235
GLfloat GLfloat p
[1]
Definition: qopenglext.h:12698
Q_DECLARE_TYPEINFO(QRect, Q_RELOCATABLE_TYPE)
constexpr size_t qHash(const QRect &r, size_t seed=0) noexcept
Definition: qrect.h:452
@ Q_RELOCATABLE_TYPE
Definition: qtypeinfo.h:156
QRect r1(100, 200, 11, 16)
[0]
QRect r2(QPoint(100, 200), QSize(11, 16))
QSharedPointer< T > other(t)
[5]
#define rhs