7#include <QtCore/qhashfunctions.h>
8#include <QtCore/qmargins.h>
9#include <QtCore/qsize.h>
10#include <QtCore/qpoint.h>
13#error qrect.h must be included before any header file that defines topLeft
16#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
19#if defined(Q_OS_WASM) || defined(Q_QDOC)
32 constexpr QRect()
noexcept : x1(0), y1(0), x2(-1), y2(-1) {}
33 constexpr QRect(
const QPoint &topleft,
const QPoint &bottomright)
noexcept;
34 constexpr QRect(
const QPoint &topleft,
const QSize &size)
noexcept;
35 constexpr QRect(
int left,
int top,
int width,
int height)
noexcept;
37 constexpr inline bool isNull()
const noexcept;
38 constexpr inline bool isEmpty()
const noexcept;
39 constexpr inline bool isValid()
const noexcept;
41 constexpr inline int left()
const noexcept;
42 constexpr inline int top()
const noexcept;
43 constexpr inline int right()
const noexcept;
44 constexpr inline int bottom()
const noexcept;
45 [[nodiscard]] QRect normalized()
const noexcept;
47 constexpr inline int x()
const noexcept;
48 constexpr inline int y()
const noexcept;
49 constexpr inline void setLeft(
int pos)
noexcept;
50 constexpr inline void setTop(
int pos)
noexcept;
51 constexpr inline void setRight(
int pos)
noexcept;
52 constexpr inline void setBottom(
int pos)
noexcept;
53 constexpr inline void setX(
int x)
noexcept;
54 constexpr inline void setY(
int y)
noexcept;
56 constexpr inline void setTopLeft(
const QPoint &p)
noexcept;
57 constexpr inline void setBottomRight(
const QPoint &p)
noexcept;
58 constexpr inline void setTopRight(
const QPoint &p)
noexcept;
59 constexpr inline void setBottomLeft(
const QPoint &p)
noexcept;
61 constexpr inline QPoint topLeft()
const noexcept;
62 constexpr inline QPoint bottomRight()
const noexcept;
63 constexpr inline QPoint topRight()
const noexcept;
64 constexpr inline QPoint bottomLeft()
const noexcept;
65 constexpr inline QPoint center()
const noexcept;
67 constexpr inline void moveLeft(
int pos)
noexcept;
68 constexpr inline void moveTop(
int pos)
noexcept;
69 constexpr inline void moveRight(
int pos)
noexcept;
70 constexpr inline void moveBottom(
int pos)
noexcept;
71 constexpr inline void moveTopLeft(
const QPoint &p)
noexcept;
72 constexpr inline void moveBottomRight(
const QPoint &p)
noexcept;
73 constexpr inline void moveTopRight(
const QPoint &p)
noexcept;
74 constexpr inline void moveBottomLeft(
const QPoint &p)
noexcept;
75 constexpr inline void moveCenter(
const QPoint &p)
noexcept;
77 constexpr inline void translate(
int dx,
int dy)
noexcept;
78 constexpr inline void translate(
const QPoint &p)
noexcept;
79 [[nodiscard]]
constexpr inline QRect translated(
int dx,
int dy)
const noexcept;
80 [[nodiscard]]
constexpr inline QRect translated(
const QPoint &p)
const noexcept;
81 [[nodiscard]]
constexpr inline QRect transposed()
const noexcept;
83 constexpr inline void moveTo(
int x,
int t)
noexcept;
84 constexpr inline void moveTo(
const QPoint &p)
noexcept;
86 constexpr inline void setRect(
int x,
int y,
int w,
int h)
noexcept;
87 constexpr inline void getRect(
int *x,
int *y,
int *w,
int *h)
const;
89 constexpr inline void setCoords(
int x1,
int y1,
int x2,
int y2)
noexcept;
90 constexpr inline void getCoords(
int *x1,
int *y1,
int *x2,
int *y2)
const;
92 constexpr inline void adjust(
int x1,
int y1,
int x2,
int y2)
noexcept;
93 [[nodiscard]]
constexpr inline QRect adjusted(
int x1,
int y1,
int x2,
int y2)
const noexcept;
95 constexpr inline QSize size()
const noexcept;
96 constexpr inline int width()
const noexcept;
97 constexpr inline int height()
const noexcept;
98 constexpr inline void setWidth(
int w)
noexcept;
99 constexpr inline void setHeight(
int h)
noexcept;
100 constexpr inline void setSize(
const QSize &s)
noexcept;
102 QRect operator|(
const QRect &r)
const noexcept;
103 QRect operator&(
const QRect &r)
const noexcept;
104 inline QRect &operator|=(
const QRect &r)
noexcept;
105 inline QRect &operator&=(
const QRect &r)
noexcept;
107 bool contains(
const QRect &r,
bool proper =
false)
const noexcept;
108 bool contains(
const QPoint &p,
bool proper =
false)
const noexcept;
109 inline bool contains(
int x,
int y)
const noexcept;
110 inline bool contains(
int x,
int y,
bool proper)
const noexcept;
111 [[nodiscard]]
inline QRect united(
const QRect &other)
const noexcept;
112 [[nodiscard]]
inline QRect intersected(
const QRect &other)
const noexcept;
113 bool intersects(
const QRect &r)
const noexcept;
115 constexpr inline QRect marginsAdded(
const QMargins &margins)
const noexcept;
116 constexpr inline QRect marginsRemoved(
const QMargins &margins)
const noexcept;
117 constexpr inline QRect &operator+=(
const QMargins &margins)
noexcept;
118 constexpr inline QRect &operator-=(
const QMargins &margins)
noexcept;
120 [[nodiscard]]
static constexpr inline QRect span(
const QPoint &p1,
const QPoint &p2)
noexcept;
123 friend constexpr bool comparesEqual(
const QRect &r1,
const QRect &r2)
noexcept
124 {
return r1.x1==r2.x1 && r1.x2==r2.x2 && r1.y1==r2.y1 && r1.y2==r2.y2; }
125 Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QRect)
126 friend constexpr inline size_t qHash(
const QRect &, size_t)
noexcept;
129#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
130 [[nodiscard]] CGRect toCGRect()
const noexcept;
132 [[nodiscard]]
constexpr inline QRectF toRectF()
const noexcept;
144
145
146#ifndef QT_NO_DATASTREAM
147Q_CORE_EXPORT
QDataStream &operator<<(QDataStream &,
const QRect &);
152
153
155constexpr inline QRect::QRect(
int aleft,
int atop,
int awidth,
int aheight)
noexcept
156 : x1(aleft), y1(atop), x2(aleft + awidth - 1), y2(atop + aheight - 1) {}
158constexpr inline QRect::QRect(
const QPoint &atopLeft,
const QPoint &abottomRight)
noexcept
159 : x1(atopLeft.x()), y1(atopLeft.y()), x2(abottomRight.x()), y2(abottomRight.y()) {}
161constexpr inline QRect::QRect(
const QPoint &atopLeft,
const QSize &asize)
noexcept
162 : x1(atopLeft.x()), y1(atopLeft.y()), x2(atopLeft.x()+asize.width() - 1), y2(atopLeft.y()+asize.height() - 1) {}
164constexpr inline bool QRect::isNull()
const noexcept
165{
return x2 == x1 - 1 && y2 == y1 - 1; }
167constexpr inline bool QRect::isEmpty()
const noexcept
168{
return x1 > x2 || y1 > y2; }
170constexpr inline bool QRect::isValid()
const noexcept
171{
return x1 <= x2 && y1 <= y2; }
173constexpr inline int QRect::left()
const noexcept
176constexpr inline int QRect::top()
const noexcept
179constexpr inline int QRect::right()
const noexcept
182constexpr inline int QRect::bottom()
const noexcept
185constexpr inline int QRect::x()
const noexcept
188constexpr inline int QRect::y()
const noexcept
191constexpr inline void QRect::setLeft(
int pos)
noexcept
194constexpr inline void QRect::setTop(
int pos)
noexcept
197constexpr inline void QRect::setRight(
int pos)
noexcept
200constexpr inline void QRect::setBottom(
int pos)
noexcept
203constexpr inline void QRect::setTopLeft(
const QPoint &p)
noexcept
204{ x1 = p.x(); y1 = p.y(); }
206constexpr inline void QRect::setBottomRight(
const QPoint &p)
noexcept
207{ x2 = p.x(); y2 = p.y(); }
209constexpr inline void QRect::setTopRight(
const QPoint &p)
noexcept
210{ x2 = p.x(); y1 = p.y(); }
212constexpr inline void QRect::setBottomLeft(
const QPoint &p)
noexcept
213{ x1 = p.x(); y2 = p.y(); }
215constexpr inline void QRect::setX(
int ax)
noexcept
218constexpr inline void QRect::setY(
int ay)
noexcept
221constexpr inline QPoint QRect::topLeft()
const noexcept
222{
return QPoint(x1, y1); }
224constexpr inline QPoint QRect::bottomRight()
const noexcept
225{
return QPoint(x2, y2); }
227constexpr inline QPoint QRect::topRight()
const noexcept
228{
return QPoint(x2, y1); }
230constexpr inline QPoint QRect::bottomLeft()
const noexcept
231{
return QPoint(x1, y2); }
233constexpr inline QPoint QRect::center()
const noexcept
234{
return QPoint(
int((qint64(x1)+x2)/2),
int((qint64(y1)+y2)/2)); }
236constexpr inline int QRect::width()
const noexcept
237{
return x2 - x1 + 1; }
239constexpr inline int QRect::height()
const noexcept
240{
return y2 - y1 + 1; }
242constexpr inline QSize QRect::size()
const noexcept
243{
return QSize(width(), height()); }
245constexpr inline void QRect::translate(
int dx,
int dy)
noexcept
253constexpr inline void QRect::translate(
const QPoint &p)
noexcept
261constexpr inline QRect QRect::translated(
int dx,
int dy)
const noexcept
262{
return QRect(QPoint(x1 + dx, y1 + dy), QPoint(x2 + dx, y2 + dy)); }
264constexpr inline QRect QRect::translated(
const QPoint &p)
const noexcept
265{
return QRect(QPoint(x1 + p.x(), y1 + p.y()), QPoint(x2 + p.x(), y2 + p.y())); }
267constexpr inline QRect QRect::transposed()
const noexcept
268{
return QRect(topLeft(), size().transposed()); }
270constexpr inline void QRect::moveTo(
int ax,
int ay)
noexcept
278constexpr inline void QRect::moveTo(
const QPoint &p)
noexcept
286constexpr inline void QRect::moveLeft(
int pos)
noexcept
287{ x2 += (pos - x1); x1 = pos; }
289constexpr inline void QRect::moveTop(
int pos)
noexcept
290{ y2 += (pos - y1); y1 = pos; }
292constexpr inline void QRect::moveRight(
int pos)
noexcept
298constexpr inline void QRect::moveBottom(
int pos)
noexcept
304constexpr inline void QRect::moveTopLeft(
const QPoint &p)
noexcept
310constexpr inline void QRect::moveBottomRight(
const QPoint &p)
noexcept
316constexpr inline void QRect::moveTopRight(
const QPoint &p)
noexcept
322constexpr inline void QRect::moveBottomLeft(
const QPoint &p)
noexcept
328constexpr inline void QRect::moveCenter(
const QPoint &p)
noexcept
338constexpr inline void QRect::getRect(
int *ax,
int *ay,
int *aw,
int *ah)
const
346constexpr inline void QRect::setRect(
int ax,
int ay,
int aw,
int ah)
noexcept
354constexpr inline void QRect::getCoords(
int *xp1,
int *yp1,
int *xp2,
int *yp2)
const
362constexpr inline void QRect::setCoords(
int xp1,
int yp1,
int xp2,
int yp2)
noexcept
370constexpr inline QRect QRect::adjusted(
int xp1,
int yp1,
int xp2,
int yp2)
const noexcept
371{
return QRect(QPoint(x1 + xp1, y1 + yp1), QPoint(x2 + xp2, y2 + yp2)); }
373constexpr inline void QRect::adjust(
int dx1,
int dy1,
int dx2,
int dy2)
noexcept
381constexpr inline void QRect::setWidth(
int w)
noexcept
382{ x2 = (x1 + w - 1); }
384constexpr inline void QRect::setHeight(
int h)
noexcept
385{ y2 = (y1 + h - 1); }
387constexpr inline void QRect::setSize(
const QSize &s)
noexcept
389 x2 = (s.width() + x1 - 1);
390 y2 = (s.height() + y1 - 1);
393inline bool QRect::contains(
int ax,
int ay,
bool aproper)
const noexcept
395 return contains(QPoint(ax, ay), aproper);
398inline bool QRect::contains(
int ax,
int ay)
const noexcept
400 return contains(QPoint(ax, ay),
false);
403inline QRect &QRect::operator|=(
const QRect &r)
noexcept
409inline QRect &QRect::operator&=(
const QRect &r)
noexcept
415inline QRect QRect::intersected(
const QRect &other)
const noexcept
417 return *
this & other;
420inline QRect QRect::united(
const QRect &r)
const noexcept
425constexpr inline size_t qHash(
const QRect &r, size_t seed = 0)
noexcept
427 return qHashMulti(seed, r.x1, r.x2, r.y1, r.y2);
430constexpr inline QRect operator+(
const QRect &rectangle,
const QMargins &margins)
noexcept
432 return QRect(
QPoint(rectangle.left() - margins.left(), rectangle.top() - margins.top()),
433 QPoint(rectangle.right() + margins.right(), rectangle.bottom() + margins.bottom()));
436constexpr inline QRect operator+(
const QMargins &margins,
const QRect &rectangle)
noexcept
438 return QRect(
QPoint(rectangle.left() - margins.left(), rectangle.top() - margins.top()),
439 QPoint(rectangle.right() + margins.right(), rectangle.bottom() + margins.bottom()));
442constexpr inline QRect operator-(
const QRect &lhs,
const QMargins &rhs)
noexcept
444 return QRect(
QPoint(lhs.left() + rhs.left(), lhs.top() + rhs.top()),
445 QPoint(lhs.right() - rhs.right(), lhs.bottom() - rhs.bottom()));
448constexpr inline QRect QRect::marginsAdded(
const QMargins &margins)
const noexcept
450 return QRect(QPoint(x1 - margins.left(), y1 - margins.top()),
451 QPoint(x2 + margins.right(), y2 + margins.bottom()));
454constexpr inline QRect QRect::marginsRemoved(
const QMargins &margins)
const noexcept
456 return QRect(QPoint(x1 + margins.left(), y1 + margins.top()),
457 QPoint(x2 - margins.right(), y2 - margins.bottom()));
460constexpr inline QRect &QRect::operator+=(
const QMargins &margins)
noexcept
462 *
this = marginsAdded(margins);
466constexpr inline QRect &QRect::operator-=(
const QMargins &margins)
noexcept
468 *
this = marginsRemoved(margins);
472constexpr QRect QRect::span(
const QPoint &p1,
const QPoint &p2)
noexcept
474 return QRect(QPoint(qMin(p1.x(), p2.x()), qMin(p1.y(), p2.y())),
475 QPoint(qMax(p1.x(), p2.x()), qMax(p1.y(), p2.y())));
478#ifndef QT_NO_DEBUG_STREAM
479Q_CORE_EXPORT
QDebug operator<<(QDebug,
const QRect &);
486 constexpr QRectF()
noexcept : xp(0.), yp(0.), w(0.), h(0.) {}
487 constexpr QRectF(
const QPointF &topleft,
const QSizeF &size)
noexcept;
488 constexpr QRectF(
const QPointF &topleft,
const QPointF &bottomRight)
noexcept;
489 constexpr QRectF(qreal left, qreal top, qreal width, qreal height)
noexcept;
490 constexpr QRectF(
const QRect &rect)
noexcept;
492 constexpr inline bool isNull()
const noexcept;
493 constexpr inline bool isEmpty()
const noexcept;
494 constexpr inline bool isValid()
const noexcept;
495 [[nodiscard]] QRectF normalized()
const noexcept;
497 constexpr inline qreal left()
const noexcept {
return xp; }
498 constexpr inline qreal top()
const noexcept {
return yp; }
499 constexpr inline qreal right()
const noexcept {
return xp + w; }
500 constexpr inline qreal bottom()
const noexcept {
return yp + h; }
502 constexpr inline qreal x()
const noexcept;
503 constexpr inline qreal y()
const noexcept;
504 constexpr inline void setLeft(qreal pos)
noexcept;
505 constexpr inline void setTop(qreal pos)
noexcept;
506 constexpr inline void setRight(qreal pos)
noexcept;
507 constexpr inline void setBottom(qreal pos)
noexcept;
508 constexpr inline void setX(qreal pos)
noexcept { setLeft(pos); }
509 constexpr inline void setY(qreal pos)
noexcept { setTop(pos); }
511 constexpr inline QPointF topLeft()
const noexcept {
return QPointF(xp, yp); }
512 constexpr inline QPointF bottomRight()
const noexcept {
return QPointF(xp+w, yp+h); }
513 constexpr inline QPointF topRight()
const noexcept {
return QPointF(xp+w, yp); }
514 constexpr inline QPointF bottomLeft()
const noexcept {
return QPointF(xp, yp+h); }
515 constexpr inline QPointF center()
const noexcept;
517 constexpr inline void setTopLeft(
const QPointF &p)
noexcept;
518 constexpr inline void setBottomRight(
const QPointF &p)
noexcept;
519 constexpr inline void setTopRight(
const QPointF &p)
noexcept;
520 constexpr inline void setBottomLeft(
const QPointF &p)
noexcept;
522 constexpr inline void moveLeft(qreal pos)
noexcept;
523 constexpr inline void moveTop(qreal pos)
noexcept;
524 constexpr inline void moveRight(qreal pos)
noexcept;
525 constexpr inline void moveBottom(qreal pos)
noexcept;
526 constexpr inline void moveTopLeft(
const QPointF &p)
noexcept;
527 constexpr inline void moveBottomRight(
const QPointF &p)
noexcept;
528 constexpr inline void moveTopRight(
const QPointF &p)
noexcept;
529 constexpr inline void moveBottomLeft(
const QPointF &p)
noexcept;
530 constexpr inline void moveCenter(
const QPointF &p)
noexcept;
532 constexpr inline void translate(qreal dx, qreal dy)
noexcept;
533 constexpr inline void translate(
const QPointF &p)
noexcept;
535 [[nodiscard]]
constexpr inline QRectF translated(qreal dx, qreal dy)
const noexcept;
536 [[nodiscard]]
constexpr inline QRectF translated(
const QPointF &p)
const noexcept;
538 [[nodiscard]]
constexpr inline QRectF transposed()
const noexcept;
540 constexpr inline void moveTo(qreal x, qreal y)
noexcept;
541 constexpr inline void moveTo(
const QPointF &p)
noexcept;
543 constexpr inline void setRect(qreal x, qreal y, qreal w, qreal h)
noexcept;
544 constexpr inline void getRect(qreal *x, qreal *y, qreal *w, qreal *h)
const;
546 constexpr inline void setCoords(qreal x1, qreal y1, qreal x2, qreal y2)
noexcept;
547 constexpr inline void getCoords(qreal *x1, qreal *y1, qreal *x2, qreal *y2)
const;
549 constexpr inline void adjust(qreal x1, qreal y1, qreal x2, qreal y2)
noexcept;
550 [[nodiscard]]
constexpr inline QRectF adjusted(qreal x1, qreal y1, qreal x2, qreal y2)
const noexcept;
552 constexpr inline QSizeF size()
const noexcept;
553 constexpr inline qreal width()
const noexcept;
554 constexpr inline qreal height()
const noexcept;
555 constexpr inline void setWidth(qreal w)
noexcept;
556 constexpr inline void setHeight(qreal h)
noexcept;
557 constexpr inline void setSize(
const QSizeF &s)
noexcept;
559 QRectF operator|(
const QRectF &r)
const noexcept;
560 QRectF operator&(
const QRectF &r)
const noexcept;
561 inline QRectF &operator|=(
const QRectF &r)
noexcept;
562 inline QRectF &operator&=(
const QRectF &r)
noexcept;
564 bool contains(
const QRectF &r)
const noexcept;
565 bool contains(
const QPointF &p)
const noexcept;
566 inline bool contains(qreal x, qreal y)
const noexcept;
567 [[nodiscard]]
inline QRectF united(
const QRectF &other)
const noexcept;
568 [[nodiscard]]
inline QRectF intersected(
const QRectF &other)
const noexcept;
569 bool intersects(
const QRectF &r)
const noexcept;
571 constexpr inline QRectF marginsAdded(
const QMarginsF &margins)
const noexcept;
572 constexpr inline QRectF marginsRemoved(
const QMarginsF &margins)
const noexcept;
573 constexpr inline QRectF &operator+=(
const QMarginsF &margins)
noexcept;
574 constexpr inline QRectF &operator-=(
const QMarginsF &margins)
noexcept;
577 friend constexpr bool comparesEqual(
const QRectF &r1,
const QRectF &r2)
noexcept
579 return r1.topLeft() == r2.topLeft()
580 && r1.size() == r2.size();
582 Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QRectF)
584 friend constexpr bool comparesEqual(
const QRectF &r1,
const QRect &r2)
noexcept
585 {
return r1.topLeft() == r2.topLeft() && r1.size() == r2.size(); }
586 Q_DECLARE_EQUALITY_COMPARABLE_LITERAL_TYPE(QRectF, QRect)
588 friend constexpr bool qFuzzyCompare(
const QRectF &lhs,
const QRectF &rhs)
noexcept
590 return qFuzzyCompare(lhs.topLeft(), rhs.topLeft())
591 && qFuzzyCompare(lhs.bottomRight(), rhs.bottomRight());
594 friend constexpr bool qFuzzyIsNull(
const QRectF &rect)
noexcept
596 return qFuzzyIsNull(rect.w) && qFuzzyIsNull(rect.h);
600 [[nodiscard]]
constexpr inline QRect toRect()
const noexcept;
601 [[nodiscard]] QRect toAlignedRect()
const noexcept;
603#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
604 [[nodiscard]]
static QRectF fromCGRect(CGRect rect)
noexcept;
605 [[nodiscard]] CGRect toCGRect()
const noexcept;
608#if defined(Q_OS_WASM) || defined(Q_QDOC)
609 [[nodiscard]]
static QRectF fromDOMRect(emscripten::val domRect);
610 [[nodiscard]] emscripten::val toDOMRect()
const;
623
624
625#ifndef QT_NO_DATASTREAM
626Q_CORE_EXPORT
QDataStream &operator<<(QDataStream &,
const QRectF &);
631
632
634constexpr inline QRectF::QRectF(qreal aleft, qreal atop, qreal awidth, qreal aheight)
noexcept
635 : xp(aleft), yp(atop), w(awidth), h(aheight)
639constexpr inline QRectF::QRectF(
const QPointF &atopLeft,
const QSizeF &asize)
noexcept
640 : xp(atopLeft.x()), yp(atopLeft.y()), w(asize.width()), h(asize.height())
645constexpr inline QRectF::QRectF(
const QPointF &atopLeft,
const QPointF &abottomRight)
noexcept
646 : xp(atopLeft.x()), yp(atopLeft.y()), w(abottomRight.x() - atopLeft.x()), h(abottomRight.y() - atopLeft.y())
650constexpr inline QRectF::QRectF(
const QRect &r)
noexcept
651 : xp(r.x()), yp(r.y()), w(r.width()), h(r.height())
656QT_WARNING_DISABLE_FLOAT_COMPARE
658constexpr inline bool QRectF::isNull()
const noexcept
659{
return w == 0. && h == 0.; }
661constexpr inline bool QRectF::isEmpty()
const noexcept
662{
return w <= 0. || h <= 0.; }
666constexpr inline bool QRectF::isValid()
const noexcept
667{
return w > 0. && h > 0.; }
669constexpr inline qreal QRectF::x()
const noexcept
672constexpr inline qreal QRectF::y()
const noexcept
675constexpr inline void QRectF::setLeft(qreal pos)
noexcept
676{ qreal diff = pos - xp; xp += diff; w -= diff; }
678constexpr inline void QRectF::setRight(qreal pos)
noexcept
681constexpr inline void QRectF::setTop(qreal pos)
noexcept
682{ qreal diff = pos - yp; yp += diff; h -= diff; }
684constexpr inline void QRectF::setBottom(qreal pos)
noexcept
687constexpr inline void QRectF::setTopLeft(
const QPointF &p)
noexcept
688{ setLeft(p.x()); setTop(p.y()); }
690constexpr inline void QRectF::setTopRight(
const QPointF &p)
noexcept
691{ setRight(p.x()); setTop(p.y()); }
693constexpr inline void QRectF::setBottomLeft(
const QPointF &p)
noexcept
694{ setLeft(p.x()); setBottom(p.y()); }
696constexpr inline void QRectF::setBottomRight(
const QPointF &p)
noexcept
697{ setRight(p.x()); setBottom(p.y()); }
699constexpr inline QPointF QRectF::center()
const noexcept
700{
return QPointF(xp + w/2, yp + h/2); }
702constexpr inline void QRectF::moveLeft(qreal pos)
noexcept
705constexpr inline void QRectF::moveTop(qreal pos)
noexcept
708constexpr inline void QRectF::moveRight(qreal pos)
noexcept
711constexpr inline void QRectF::moveBottom(qreal pos)
noexcept
714constexpr inline void QRectF::moveTopLeft(
const QPointF &p)
noexcept
715{ moveLeft(p.x()); moveTop(p.y()); }
717constexpr inline void QRectF::moveTopRight(
const QPointF &p)
noexcept
718{ moveRight(p.x()); moveTop(p.y()); }
720constexpr inline void QRectF::moveBottomLeft(
const QPointF &p)
noexcept
721{ moveLeft(p.x()); moveBottom(p.y()); }
723constexpr inline void QRectF::moveBottomRight(
const QPointF &p)
noexcept
724{ moveRight(p.x()); moveBottom(p.y()); }
726constexpr inline void QRectF::moveCenter(
const QPointF &p)
noexcept
727{ xp = p.x() - w/2; yp = p.y() - h/2; }
729constexpr inline qreal QRectF::width()
const noexcept
732constexpr inline qreal QRectF::height()
const noexcept
735constexpr inline QSizeF QRectF::size()
const noexcept
736{
return QSizeF(w, h); }
738constexpr inline void QRectF::translate(qreal dx, qreal dy)
noexcept
744constexpr inline void QRectF::translate(
const QPointF &p)
noexcept
750constexpr inline void QRectF::moveTo(qreal ax, qreal ay)
noexcept
756constexpr inline void QRectF::moveTo(
const QPointF &p)
noexcept
762constexpr inline QRectF QRectF::translated(qreal dx, qreal dy)
const noexcept
764 return QRectF(xp + dx, yp + dy, w, h);
767constexpr inline QRectF QRectF::translated(
const QPointF &p)
const noexcept
768{
return QRectF(xp + p.x(), yp + p.y(), w, h); }
770constexpr inline QRectF QRectF::transposed()
const noexcept
771{
return QRectF(topLeft(), size().transposed()); }
773constexpr inline void QRectF::getRect(qreal *ax, qreal *ay, qreal *aaw, qreal *aah)
const
781constexpr inline void QRectF::setRect(qreal ax, qreal ay, qreal aaw, qreal aah)
noexcept
789constexpr inline void QRectF::getCoords(qreal *xp1, qreal *yp1, qreal *xp2, qreal *yp2)
const
797constexpr inline void QRectF::setCoords(qreal xp1, qreal yp1, qreal xp2, qreal yp2)
noexcept
805constexpr inline void QRectF::adjust(qreal xp1, qreal yp1, qreal xp2, qreal yp2)
noexcept
813constexpr inline QRectF QRectF::adjusted(qreal xp1, qreal yp1, qreal xp2, qreal yp2)
const noexcept
815 return QRectF(xp + xp1, yp + yp1, w + xp2 - xp1, h + yp2 - yp1);
818constexpr inline void QRectF::setWidth(qreal aw)
noexcept
821constexpr inline void QRectF::setHeight(qreal ah)
noexcept
824constexpr inline void QRectF::setSize(
const QSizeF &s)
noexcept
830inline bool QRectF::contains(qreal ax, qreal ay)
const noexcept
832 return contains(QPointF(ax, ay));
835inline QRectF &QRectF::operator|=(
const QRectF &r)
noexcept
841inline QRectF &QRectF::operator&=(
const QRectF &r)
noexcept
847inline QRectF QRectF::intersected(
const QRectF &r)
const noexcept
852inline QRectF QRectF::united(
const QRectF &r)
const noexcept
857constexpr QRectF QRect::toRectF()
const noexcept {
return *
this; }
859constexpr inline QRect QRectF::toRect()
const noexcept
864 const int nxp = qRound(xp);
865 const int nyp = qRound(yp);
866 const int nw = qRound(w + (xp - nxp) / 2);
867 const int nh = qRound(h + (yp - nyp) / 2);
868 return QRect(nxp, nyp, nw, nh);
871constexpr inline QRectF
operator+(
const QRectF &lhs,
const QMarginsF &rhs)
noexcept
873 return QRectF(
QPointF(lhs.left() - rhs.left(), lhs.top() - rhs.top()),
874 QSizeF(lhs.width() + rhs.left() + rhs.right(), lhs.height() + rhs.top() + rhs.bottom()));
877constexpr inline QRectF
operator+(
const QMarginsF &lhs,
const QRectF &rhs)
noexcept
879 return QRectF(
QPointF(rhs.left() - lhs.left(), rhs.top() - lhs.top()),
880 QSizeF(rhs.width() + lhs.left() + lhs.right(), rhs.height() + lhs.top() + lhs.bottom()));
883constexpr inline QRectF
operator-(
const QRectF &lhs,
const QMarginsF &rhs)
noexcept
885 return QRectF(
QPointF(lhs.left() + rhs.left(), lhs.top() + rhs.top()),
886 QSizeF(lhs.width() - rhs.left() - rhs.right(), lhs.height() - rhs.top() - rhs.bottom()));
889constexpr inline QRectF QRectF::marginsAdded(
const QMarginsF &margins)
const noexcept
891 return QRectF(QPointF(xp - margins.left(), yp - margins.top()),
892 QSizeF(w + margins.left() + margins.right(), h + margins.top() + margins.bottom()));
895constexpr inline QRectF QRectF::marginsRemoved(
const QMarginsF &margins)
const noexcept
897 return QRectF(QPointF(xp + margins.left(), yp + margins.top()),
898 QSizeF(w - margins.left() - margins.right(), h - margins.top() - margins.bottom()));
901constexpr inline QRectF &QRectF::operator+=(
const QMarginsF &margins)
noexcept
903 *
this = marginsAdded(margins);
907constexpr inline QRectF &QRectF::operator-=(
const QMarginsF &margins)
noexcept
909 *
this = marginsRemoved(margins);
913#ifndef QT_NO_DEBUG_STREAM
914Q_CORE_EXPORT
QDebug operator<<(QDebug,
const QRectF &);
static bool readIniSection(const QSettingsKey §ion, QByteArrayView data, ParsedSettingsMap *settingsMap)
void set(const QString &key, const QVariant &value) override
QStringList children(const QString &prefix, ChildSpec spec) const override
~QConfFileSettingsPrivate()
virtual void initAccess()
bool readIniFile(QByteArrayView data, UnparsedSettingsMap *unparsedIniSections)
bool isWritable() const override
QString fileName() const override
QConfFileSettingsPrivate(QSettings::Format format, QSettings::Scope scope, const QString &organization, const QString &application)
void remove(const QString &key) override
QConfFileSettingsPrivate(const QString &fileName, QSettings::Format format)
const QList< QConfFile * > & getConfFiles() const
static bool readIniLine(QByteArrayView data, qsizetype &dataPos, qsizetype &lineStart, qsizetype &lineLen, qsizetype &equalsPos)
std::optional< QVariant > get(const QString &key) const override
UnparsedSettingsMap unparsedIniSections
ParsedSettingsMap originalKeys
static Q_AUTOTEST_EXPORT void clearCache()
ParsedSettingsMap removedKeys
ParsedSettingsMap mergedKeyMap() const
static QConfFile * fromName(const QString &name, bool _userPerms)
ParsedSettingsMap addedKeys
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
constexpr qreal & ry() noexcept
Returns a reference to the y coordinate of this point.
constexpr qreal x() const noexcept
Returns the x coordinate of this point.
constexpr qreal manhattanLength() const
constexpr qreal y() const noexcept
Returns the y coordinate of this point.
constexpr QPointF & operator+=(const QPointF &p)
Adds the given point to this point and returns a reference to this point.
constexpr qreal & rx() noexcept
Returns a reference to the x coordinate of this point.
constexpr QPointF & operator*=(qreal c)
Multiplies this point's coordinates by the given finite factor, and returns a reference to this point...
constexpr QPointF transposed() const noexcept
constexpr void setY(qreal y) noexcept
Sets the y coordinate of this point to the given finite y coordinate.
constexpr QPointF & operator-=(const QPointF &p)
Subtracts the given point from this point and returns a reference to this point.
constexpr QPointF() noexcept
Constructs a null point, i.e.
constexpr QPointF(qreal xpos, qreal ypos) noexcept
Constructs a point with the given coordinates (xpos, ypos).
constexpr void setX(qreal x) noexcept
Sets the x coordinate of this point to the given finite x coordinate.
constexpr QPointF & operator/=(qreal c)
Divides both x and y by the given divisor, and returns a reference to this point.
constexpr QPointF(const QPoint &p) noexcept
Constructs a copy of the given point.
bool isNull() const noexcept
Returns true if both the x and y coordinates are set to 0.0 (ignoring the sign); otherwise returns fa...
static constexpr qreal dotProduct(const QPointF &p1, const QPointF &p2)
\inmodule QtCore\reentrant
constexpr bool isNull() const noexcept
Returns true if both the x and y coordinates are set to 0, otherwise returns false.
constexpr QPoint & operator*=(double factor)
Multiplies this point's coordinates by the given factor, and returns a reference to this point.
constexpr int & ry() noexcept
Returns a reference to the y coordinate of this point.
constexpr int & rx() noexcept
Returns a reference to the x coordinate of this point.
constexpr QPoint transposed() const noexcept
constexpr int x() const noexcept
Returns the x coordinate of this point.
constexpr void setY(int y) noexcept
Sets the y coordinate of this point to the given y coordinate.
constexpr QPoint & operator*=(int factor)
Multiplies this point's coordinates by the given factor, and returns a reference to this point.
constexpr QPoint & operator+=(const QPoint &p)
Adds the given point to this point and returns a reference to this point.
constexpr int manhattanLength() const
Returns the sum of the absolute values of x() and y(), traditionally known as the "Manhattan length" ...
constexpr QPoint(int xpos, int ypos) noexcept
Constructs a point with the given coordinates (xpos, ypos).
constexpr int y() const noexcept
Returns the y coordinate of this point.
static constexpr int dotProduct(const QPoint &p1, const QPoint &p2)
constexpr void setX(int x) noexcept
Sets the x coordinate of this point to the given x coordinate.
constexpr QPoint & operator*=(float factor)
Multiplies this point's coordinates by the given factor, and returns a reference to this point.
constexpr QPoint & operator-=(const QPoint &p)
Subtracts the given point from this point and returns a reference to this point.
constexpr QPoint & operator/=(qreal divisor)
This is an overloaded member function, provided for convenience. It differs from the above function o...
constexpr QPoint() noexcept
Constructs a null point, i.e.
friend constexpr bool comparesEqual(const QPoint &p1, const QPoint &p2) noexcept
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
QSettingsGroup(const QString &s, bool guessArraySize)
qsizetype arraySizeGuess() const
QSettingsGroup(const QString &s)
void setArrayIndex(qsizetype i)
QSettingsIniKey(const QString &str, qsizetype pos=-1)
QSettingsKey(const QString &key, Qt::CaseSensitivity cs, qsizetype=-1)
QString originalCaseKey() const
qsizetype originalKeyPosition() const
Combined button and popup list for selecting options.
QDataStream & readListBasedContainer(QDataStream &s, Container &c)
QDataStream & readAssociativeContainer(QDataStream &s, Container &c)
QDataStream & writeAssociativeContainer(QDataStream &s, const Container &c)
QDataStream & writeAssociativeMultiContainer(QDataStream &s, const Container &c)
QDataStream & writeSequentialContainer(QDataStream &s, const Container &c)
QDataStream & readArrayBasedContainer(QDataStream &s, Container &c)
static const char charTraits[256]
QByteArray operator+(const QByteArray &a1, const QByteArray &a2)
Q_DECLARE_TYPEINFO(QByteArrayView, Q_PRIMITIVE_TYPE)
std::enable_if_t< std::is_enum< T >::value, QDataStream & > operator>>(QDataStream &s, T &t)
QDataStream & operator>>(QDataStream &s, QFlags< Enum > &e)
QDataStreamIfHasIStreamOperators< T1, T2 > operator>>(QDataStream &s, std::pair< T1, T2 > &p)
QDataStream & operator>>(QDataStream &s, QKeyCombination &combination)
QDataStreamIfHasIStreamOperatorsContainer< QHash< Key, T >, Key, T > operator>>(QDataStream &s, QHash< Key, T > &hash)
QDataStreamIfHasIStreamOperatorsContainer< QList< T >, T > operator>>(QDataStream &s, QList< T > &v)
Q_CORE_EXPORT QDebug operator<<(QDebug debug, QDir::Filters filters)
QT_REQUIRE_CONFIG(itemmodel)
size_t qHash(QPointF, size_t seed=0)=delete
Q_DECLARE_TYPEINFO(QPointF, Q_PRIMITIVE_TYPE)
Q_DECLARE_TYPEINFO(QPoint, Q_PRIMITIVE_TYPE)
constexpr QRectF operator+(const QRectF &lhs, const QMarginsF &rhs) noexcept
constexpr QRectF operator+(const QMarginsF &lhs, const QRectF &rhs) noexcept
Q_DECLARE_TYPEINFO(QRectF, Q_RELOCATABLE_TYPE)
constexpr QRectF operator-(const QRectF &lhs, const QMarginsF &rhs) noexcept
constexpr QRect operator-(const QRect &lhs, const QMargins &rhs) noexcept
QMap< QString, QSettingsIniSection > IniMap
QList< QConfFileCustomFormat > CustomFormatVector
static bool operator<(const QSettingsIniKey &k1, const QSettingsIniKey &k2)
static constexpr QChar sep
static Path getPath(QSettings::Format format, QSettings::Scope scope)
QMap< QSettingsIniKey, QVariant > IniKeyMap
static int pathHashKey(QSettings::Format format, QSettings::Scope scope)
static QString make_user_path()
static std::unique_lock< QBasicMutex > initDefaultPaths(std::unique_lock< QBasicMutex > locker)
static QString make_user_path_without_qstandard_paths()
QHash< QString, QConfFile * > ConfFileHash
QHash< int, Path > PathHash
Q_DECLARE_TYPEINFO(QSettingsIniSection, Q_RELOCATABLE_TYPE)
Q_DECLARE_TYPEINFO(QConfFileCustomFormat, Q_RELOCATABLE_TYPE)
Q_DECLARE_TYPEINFO(QSettingsIniKey, Q_RELOCATABLE_TYPE)
QCache< QString, QConfFile > ConfFileCache
#define FLUSH_CURRENT_SECTION()
static void iniChopTrailingSpaces(QString &str, qsizetype limit)
Q_DECLARE_TYPEINFO(QSettingsGroup, Q_RELOCATABLE_TYPE)
static const Qt::CaseSensitivity IniCaseSensitivity
Q_DECLARE_TYPEINFO(QSettingsKey, Q_RELOCATABLE_TYPE)
QMap< QSettingsKey, QByteArray > UnparsedSettingsMap
QMap< QSettingsKey, QVariant > ParsedSettingsMap
#define QT_QSETTINGS_ALWAYS_CASE_SENSITIVE_AND_FORGET_ORIGINAL_KEY_ORDER
Q_DECLARE_TYPEINFO(QSizeF, Q_RELOCATABLE_TYPE)
constexpr size_t qHash(const QSize &s, size_t seed=0) noexcept