1 /*
2  * DQt - D bindings for the Qt Toolkit
3  *
4  * GNU Lesser General Public License Usage
5  * This file may be used under the terms of the GNU Lesser
6  * General Public License version 3 as published by the Free Software
7  * Foundation and appearing in the file LICENSE.LGPL3 included in the
8  * packaging of this file. Please review the following information to
9  * ensure the GNU Lesser General Public License version 3 requirements
10  * will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
11  */
12 module qt.core.rect;
13 extern(C++):
14 
15 import qt.config;
16 import qt.core.global;
17 import qt.core.margins;
18 import qt.core.point;
19 import qt.core.size;
20 import qt.core.typeinfo;
21 import qt.helpers;
22 
23 /+ #ifdef topLeft
24 #error qrect.h must be included before any header file that defines topLeft
25 #endif
26 
27 #if defined(Q_OS_DARWIN) || defined(Q_QDOC)
28 struct CGRect;
29 #endif +/
30 
31 
32 /// Binding for C++ class [QRect](https://doc.qt.io/qt-6/qrect.html).
33 @Q_RELOCATABLE_TYPE extern(C++, class) struct /+ Q_CORE_EXPORT +/ QRect
34 {
35 public:
36     /+this()/+ noexcept+/
37     {
38         this.x1 = 0;
39         this.y1 = 0;
40         this.x2 = -1;
41         this.y2 = -1;
42     }+/
43     pragma(inline, true) this(ref const(QPoint) atopLeft, ref const(QPoint) abottomRight)/+ noexcept+/
44     {
45         this.x1 = atopLeft.x();
46         this.y1 = atopLeft.y();
47         this.x2 = abottomRight.x();
48         this.y2 = abottomRight.y();
49     }
50     pragma(inline, true) this(ref const(QPoint) atopLeft, ref const(QSize) asize)/+ noexcept+/
51     {
52         this.x1 = atopLeft.x();
53         this.y1 = atopLeft.y();
54         this.x2 = atopLeft.x()+asize.width() - 1;
55         this.y2 = atopLeft.y()+asize.height() - 1;
56     }
57     pragma(inline, true) this(int aleft, int atop, int awidth, int aheight)/+ noexcept+/
58     {
59         this.x1 = aleft;
60         this.y1 = atop;
61         this.x2 = aleft + awidth - 1;
62         this.y2 = atop + aheight - 1;
63     }
64 
65     pragma(inline, true) bool isNull() const/+ noexcept+/
66     { return x2 == x1 - 1 && y2 == y1 - 1; }
67     pragma(inline, true) bool isEmpty() const/+ noexcept+/
68     { return x1 > x2 || y1 > y2; }
69     pragma(inline, true) bool isValid() const/+ noexcept+/
70     { return x1 <= x2 && y1 <= y2; }
71 
72     pragma(inline, true) int left() const/+ noexcept+/
73     { return x1; }
74     pragma(inline, true) int top() const/+ noexcept+/
75     { return y1; }
76     pragma(inline, true) int right() const/+ noexcept+/
77     { return x2; }
78     pragma(inline, true) int bottom() const/+ noexcept+/
79     { return y2; }
80     /+ [[nodiscard]] +/ QRect normalized() const/+ noexcept+/;
81 
82     pragma(inline, true) int x() const/+ noexcept+/
83     { return x1; }
84     pragma(inline, true) int y() const/+ noexcept+/
85     { return y1; }
86     pragma(inline, true) void setLeft(int pos)/+ noexcept+/
87     { x1 = pos; }
88     pragma(inline, true) void setTop(int pos)/+ noexcept+/
89     { y1 = pos; }
90     pragma(inline, true) void setRight(int pos)/+ noexcept+/
91     { x2 = pos; }
92     pragma(inline, true) void setBottom(int pos)/+ noexcept+/
93     { y2 = pos; }
94     pragma(inline, true) void setX(int ax)/+ noexcept+/
95     { x1 = ax; }
96     pragma(inline, true) void setY(int ay)/+ noexcept+/
97     { y1 = ay; }
98 
99     pragma(inline, true) void setTopLeft(ref const(QPoint) p)/+ noexcept+/
100     { x1 = p.x(); y1 = p.y(); }
101     pragma(inline, true) void setBottomRight(ref const(QPoint) p)/+ noexcept+/
102     { x2 = p.x(); y2 = p.y(); }
103     pragma(inline, true) void setTopRight(ref const(QPoint) p)/+ noexcept+/
104     { x2 = p.x(); y1 = p.y(); }
105     pragma(inline, true) void setBottomLeft(ref const(QPoint) p)/+ noexcept+/
106     { x1 = p.x(); y2 = p.y(); }
107 
108     pragma(inline, true) QPoint topLeft() const/+ noexcept+/
109     { return QPoint(x1, y1); }
110     pragma(inline, true) QPoint bottomRight() const/+ noexcept+/
111     { return QPoint(x2, y2); }
112     pragma(inline, true) QPoint topRight() const/+ noexcept+/
113     { return QPoint(x2, y1); }
114     pragma(inline, true) QPoint bottomLeft() const/+ noexcept+/
115     { return QPoint(x1, y2); }
116     pragma(inline, true) QPoint center() const/+ noexcept+/
117     { return QPoint(cast(int)((qint64(x1)+x2)/2), cast(int)((qint64(y1)+y2)/2)); } // cast avoids overflow on addition
118 
119 
120     pragma(inline, true) void moveLeft(int pos)/+ noexcept+/
121     { x2 += (pos - x1); x1 = pos; }
122     pragma(inline, true) void moveTop(int pos)/+ noexcept+/
123     { y2 += (pos - y1); y1 = pos; }
124     pragma(inline, true) void moveRight(int pos)/+ noexcept+/
125     {
126         x1 += (pos - x2);
127         x2 = pos;
128     }
129     pragma(inline, true) void moveBottom(int pos)/+ noexcept+/
130     {
131         y1 += (pos - y2);
132         y2 = pos;
133     }
134     pragma(inline, true) void moveTopLeft(ref const(QPoint) p)/+ noexcept+/
135     {
136         moveLeft(p.x());
137         moveTop(p.y());
138     }
139     pragma(inline, true) void moveBottomRight(ref const(QPoint) p)/+ noexcept+/
140     {
141         moveRight(p.x());
142         moveBottom(p.y());
143     }
144     pragma(inline, true) void moveTopRight(ref const(QPoint) p)/+ noexcept+/
145     {
146         moveRight(p.x());
147         moveTop(p.y());
148     }
149     pragma(inline, true) void moveBottomLeft(ref const(QPoint) p)/+ noexcept+/
150     {
151         moveLeft(p.x());
152         moveBottom(p.y());
153     }
154     pragma(inline, true) void moveCenter(ref const(QPoint) p)/+ noexcept+/
155     {
156         int w = x2 - x1;
157         int h = y2 - y1;
158         x1 = p.x() - w/2;
159         y1 = p.y() - h/2;
160         x2 = x1 + w;
161         y2 = y1 + h;
162     }
163 
164     pragma(inline, true) void translate(int dx, int dy)/+ noexcept+/
165     {
166         x1 += dx;
167         y1 += dy;
168         x2 += dx;
169         y2 += dy;
170     }
171     pragma(inline, true) void translate(ref const(QPoint) p)/+ noexcept+/
172     {
173         x1 += p.x();
174         y1 += p.y();
175         x2 += p.x();
176         y2 += p.y();
177     }
178     /+ [[nodiscard]] +/ pragma(inline, true) QRect translated(int dx, int dy) const/+ noexcept+/
179     { auto tmp = QPoint(x1 + dx, y1 + dy); auto tmp__1 = QPoint(x2 + dx, y2 + dy); return QRect(tmp, tmp__1); }
180     /+ [[nodiscard]] +/ pragma(inline, true) QRect translated(ref const(QPoint) p) const/+ noexcept+/
181     { auto tmp = QPoint(x1 + p.x(), y1 + p.y()); auto tmp__1 = QPoint(x2 + p.x(), y2 + p.y()); return QRect(tmp, tmp__1); }
182     /+ [[nodiscard]] +/ pragma(inline, true) QRect transposed() const/+ noexcept+/
183     { auto tmp = topLeft(); auto tmp__1 = size().transposed(); return QRect(tmp, tmp__1); }
184 
185     pragma(inline, true) void moveTo(int ax, int ay)/+ noexcept+/
186     {
187         x2 += ax - x1;
188         y2 += ay - y1;
189         x1 = ax;
190         y1 = ay;
191     }
192     pragma(inline, true) void moveTo(ref const(QPoint) p)/+ noexcept+/
193     {
194         x2 += p.x() - x1;
195         y2 += p.y() - y1;
196         x1 = p.x();
197         y1 = p.y();
198     }
199 
200     pragma(inline, true) void setRect(int ax, int ay, int aw, int ah)/+ noexcept+/
201     {
202         x1 = ax;
203         y1 = ay;
204         x2 = (ax + aw - 1);
205         y2 = (ay + ah - 1);
206     }
207     pragma(inline, true) void getRect(int* ax, int* ay, int* aw, int* ah) const
208     {
209         *ax = x1;
210         *ay = y1;
211         *aw = x2 - x1 + 1;
212         *ah = y2 - y1 + 1;
213     }
214 
215     pragma(inline, true) void setCoords(int xp1, int yp1, int xp2, int yp2)/+ noexcept+/
216     {
217         x1 = xp1;
218         y1 = yp1;
219         x2 = xp2;
220         y2 = yp2;
221     }
222     pragma(inline, true) void getCoords(int* xp1, int* yp1, int* xp2, int* yp2) const
223     {
224         *xp1 = x1;
225         *yp1 = y1;
226         *xp2 = x2;
227         *yp2 = y2;
228     }
229 
230     pragma(inline, true) void adjust(int dx1, int dy1, int dx2, int dy2)/+ noexcept+/
231     {
232         x1 += dx1;
233         y1 += dy1;
234         x2 += dx2;
235         y2 += dy2;
236     }
237     /+ [[nodiscard]] +/ pragma(inline, true) QRect adjusted(int xp1, int yp1, int xp2, int yp2) const/+ noexcept+/
238     { auto tmp = QPoint(x1 + xp1, y1 + yp1); auto tmp__1 = QPoint(x2 + xp2, y2 + yp2); return QRect(tmp, tmp__1); }
239 
240     pragma(inline, true) QSize size() const/+ noexcept+/
241     { return QSize(width(), height()); }
242     pragma(inline, true) int width() const/+ noexcept+/
243     { return  x2 - x1 + 1; }
244     pragma(inline, true) int height() const/+ noexcept+/
245     { return  y2 - y1 + 1; }
246     pragma(inline, true) void setWidth(int w)/+ noexcept+/
247     { x2 = (x1 + w - 1); }
248     pragma(inline, true) void setHeight(int h)/+ noexcept+/
249     { y2 = (y1 + h - 1); }
250     pragma(inline, true) void setSize(ref const(QSize) s)/+ noexcept+/
251     {
252         x2 = (s.width()  + x1 - 1);
253         y2 = (s.height() + y1 - 1);
254     }
255 
256     QRect opBinary(string op)(ref const(QRect) r) const/+ noexcept+/ if(op == "|");
257     QRect opBinary(string op)(ref const(QRect) r) const/+ noexcept+/ if(op == "&");
258     pragma(inline, true) ref QRect opOpAssign(string op)(ref const(QRect) r)/+ noexcept+/ if(op == "|")
259     {
260         this = this | r;
261         return this;
262     }
263     pragma(inline, true) ref QRect opOpAssign(string op)(ref const(QRect) r)/+ noexcept+/ if(op == "&")
264     {
265         this = this & r;
266         return this;
267     }
268 
269     bool contains(ref const(QRect) r, bool proper = false) const/+ noexcept+/;
270     bool contains(ref const(QPoint) p, bool proper = false) const/+ noexcept+/;
271     pragma(inline, true) bool contains(int ax, int ay) const/+ noexcept+/
272     {
273         auto tmp = QPoint(ax, ay); return contains(tmp, false);
274     }
275     pragma(inline, true) bool contains(int ax, int ay, bool aproper) const/+ noexcept+/
276     {
277         auto tmp = QPoint(ax, ay); return contains(tmp, aproper);
278     }
279     /+ [[nodiscard]] +/ pragma(inline, true) QRect united(ref const(QRect) r) const/+ noexcept+/
280     {
281         return this | r;
282     }
283     /+ [[nodiscard]] +/ pragma(inline, true) QRect intersected(ref const(QRect) other) const/+ noexcept+/
284     {
285         return this & other;
286     }
287     bool intersects(ref const(QRect) r) const/+ noexcept+/;
288 
289     pragma(inline, true) QRect marginsAdded(ref const(QMargins) margins) const/+ noexcept+/
290     {
291         auto tmp = QPoint(x1 - margins.left(), y1 - margins.top()); auto tmp__1 = QPoint(x2 + margins.right(), y2 + margins.bottom()); return QRect(tmp,
292                      tmp__1);
293     }
294     pragma(inline, true) QRect marginsRemoved(ref const(QMargins) margins) const/+ noexcept+/
295     {
296         auto tmp = QPoint(x1 + margins.left(), y1 + margins.top()); auto tmp__1 = QPoint(x2 - margins.right(), y2 - margins.bottom()); return QRect(tmp,
297                      tmp__1);
298     }
299     pragma(inline, true) ref QRect opOpAssign(string op)(ref const(QMargins) margins)/+ noexcept+/ if(op == "+")
300     {
301         this = marginsAdded(margins);
302         return this;
303     }
304     pragma(inline, true) ref QRect opOpAssign(string op)(ref const(QMargins) margins)/+ noexcept+/ if(op == "-")
305     {
306         this = marginsRemoved(margins);
307         return this;
308     }
309 
310     /+ [[nodiscard]] +/ pragma(inline, true) static QRect span(ref const(QPoint) p1, ref const(QPoint) p2)/+ noexcept+/
311     {
312         auto tmp = QPoint(qMin(p1.x(), p2.x()), qMin(p1.y(), p2.y())); auto tmp__1 = QPoint(qMax(p1.x(), p2.x()), qMax(p1.y(), p2.y())); return QRect(tmp,
313                      tmp__1);
314     }
315 
316     /+ friend constexpr inline bool operator==(const QRect &r1, const QRect &r2) noexcept
317     { return r1.x1==r2.x1 && r1.x2==r2.x2 && r1.y1==r2.y1 && r1.y2==r2.y2; } +/
318     /+ friend constexpr inline bool operator!=(const QRect &r1, const QRect &r2) noexcept
319     { return r1.x1!=r2.x1 || r1.x2!=r2.x2 || r1.y1!=r2.y1 || r1.y2!=r2.y2; } +/
320     /+ friend constexpr inline size_t qHash(const QRect &, size_t) noexcept; +/
321 
322     static if((versionIsSet!("OSX") || versionIsSet!("iOS") || versionIsSet!("TVOS") || versionIsSet!("WatchOS")))
323     {
324         /+ [[nodiscard]] CGRect toCGRect() const noexcept; +/
325     }
326 
327 private:
328     int x1 = 0;
329     int y1 = 0;
330     int x2 = -1;
331     int y2 = -1;
332     mixin(CREATE_CONVENIENCE_WRAPPERS);
333 }
334 /+ Q_DECLARE_TYPEINFO(QRect, Q_RELOCATABLE_TYPE);
335 
336 
337 /*****************************************************************************
338   QRect stream functions
339  *****************************************************************************/
340 #ifndef QT_NO_DATASTREAM
341 Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QRect &);
342 Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QRect &);
343 #endif
344 
345 /*****************************************************************************
346   QRect inline member functions
347  *****************************************************************************/
348 
349 constexpr inline size_t qHash(const QRect &r, size_t seed = 0) noexcept
350 {
351     return qHashMulti(seed, r.x1, r.x2, r.y1, r.y2);
352 } +/
353 
354 /+pragma(inline, true) QRect operator +(ref const(QRect) rectangle, ref const(QMargins) margins)/+ noexcept+/
355 {
356     auto tmp = QPoint(rectangle.left() - margins.left(), rectangle.top() - margins.top()); auto tmp__1 = QPoint(rectangle.right() + margins.right(), rectangle.bottom() + margins.bottom()); return QRect(tmp,
357                  tmp__1);
358 }+/
359 
360 /+pragma(inline, true) QRect operator +(ref const(QMargins) margins, ref const(QRect) rectangle)/+ noexcept+/
361 {
362     auto tmp = QPoint(rectangle.left() - margins.left(), rectangle.top() - margins.top()); auto tmp__1 = QPoint(rectangle.right() + margins.right(), rectangle.bottom() + margins.bottom()); return QRect(tmp,
363                  tmp__1);
364 }+/
365 
366 /+pragma(inline, true) QRect operator -(ref const(QRect) lhs, ref const(QMargins) rhs)/+ noexcept+/
367 {
368     auto tmp = QPoint(lhs.left() + rhs.left(), lhs.top() + rhs.top()); auto tmp__1 = QPoint(lhs.right() - rhs.right(), lhs.bottom() - rhs.bottom()); return QRect(tmp,
369                  tmp__1);
370 }+/
371 
372 /+ #ifndef QT_NO_DEBUG_STREAM
373 Q_CORE_EXPORT QDebug operator<<(QDebug, const QRect &);
374 #endif +/
375 
376 
377 /// Binding for C++ class [QRectF](https://doc.qt.io/qt-6/qrectf.html).
378 @Q_RELOCATABLE_TYPE extern(C++, class) struct /+ Q_CORE_EXPORT +/ QRectF
379 {
380 public:
381     /+this()/+ noexcept+/
382     {
383         this.xp = 0.;
384         this.yp = 0.;
385         this.w = 0.;
386         this.h = 0.;
387     }+/
388     pragma(inline, true) this(ref const(QPointF) atopLeft, ref const(QSizeF) asize)/+ noexcept+/
389     {
390         this.xp = atopLeft.x();
391         this.yp = atopLeft.y();
392         this.w = asize.width();
393         this.h = asize.height();
394     }
395     pragma(inline, true) this(ref const(QPointF) atopLeft, ref const(QPointF) abottomRight)/+ noexcept+/
396     {
397         this.xp = atopLeft.x();
398         this.yp = atopLeft.y();
399         this.w = abottomRight.x() - atopLeft.x();
400         this.h = abottomRight.y() - atopLeft.y();
401     }
402     pragma(inline, true) this(qreal aleft, qreal atop, qreal awidth, qreal aheight)/+ noexcept+/
403     {
404         this.xp = aleft;
405         this.yp = atop;
406         this.w = awidth;
407         this.h = aheight;
408     }
409     pragma(inline, true) this(ref const(QRect) r)/+ noexcept+/
410     {
411         this.xp = r.x();
412         this.yp = r.y();
413         this.w = r.width();
414         this.h = r.height();
415     }
416 
417     pragma(inline, true) bool isNull() const/+ noexcept+/
418     { return w == 0. && h == 0.; }
419     pragma(inline, true) bool isEmpty() const/+ noexcept+/
420     { return w <= 0. || h <= 0.; }
421     pragma(inline, true) bool isValid() const/+ noexcept+/
422     { return w > 0. && h > 0.; }
423     /+ [[nodiscard]] +/ QRectF normalized() const/+ noexcept+/;
424 
425     pragma(inline, true) qreal left() const/+ noexcept+/ { return xp; }
426     pragma(inline, true) qreal top() const/+ noexcept+/ { return yp; }
427     pragma(inline, true) qreal right() const/+ noexcept+/ { return xp + w; }
428     pragma(inline, true) qreal bottom() const/+ noexcept+/ { return yp + h; }
429 
430     pragma(inline, true) qreal x() const/+ noexcept+/
431     { return xp; }
432     pragma(inline, true) qreal y() const/+ noexcept+/
433     { return yp; }
434     pragma(inline, true) void setLeft(qreal pos)/+ noexcept+/
435     { qreal diff = pos - xp; xp += diff; w -= diff; }
436     pragma(inline, true) void setTop(qreal pos)/+ noexcept+/
437     { qreal diff = pos - yp; yp += diff; h -= diff; }
438     pragma(inline, true) void setRight(qreal pos)/+ noexcept+/
439     { w = pos - xp; }
440     pragma(inline, true) void setBottom(qreal pos)/+ noexcept+/
441     { h = pos - yp; }
442     pragma(inline, true) void setX(qreal pos)/+ noexcept+/ { setLeft(pos); }
443     pragma(inline, true) void setY(qreal pos)/+ noexcept+/ { setTop(pos); }
444 
445     pragma(inline, true) QPointF topLeft() const/+ noexcept+/ { return QPointF(xp, yp); }
446     pragma(inline, true) QPointF bottomRight() const/+ noexcept+/ { return QPointF(xp+w, yp+h); }
447     pragma(inline, true) QPointF topRight() const/+ noexcept+/ { return QPointF(xp+w, yp); }
448     pragma(inline, true) QPointF bottomLeft() const/+ noexcept+/ { return QPointF(xp, yp+h); }
449     pragma(inline, true) QPointF center() const/+ noexcept+/
450     { return QPointF(xp + w/2, yp + h/2); }
451 
452     pragma(inline, true) void setTopLeft(ref const(QPointF) p)/+ noexcept+/
453     { setLeft(p.x()); setTop(p.y()); }
454     pragma(inline, true) void setBottomRight(ref const(QPointF) p)/+ noexcept+/
455     { setRight(p.x()); setBottom(p.y()); }
456     pragma(inline, true) void setTopRight(ref const(QPointF) p)/+ noexcept+/
457     { setRight(p.x()); setTop(p.y()); }
458     pragma(inline, true) void setBottomLeft(ref const(QPointF) p)/+ noexcept+/
459     { setLeft(p.x()); setBottom(p.y()); }
460 
461     pragma(inline, true) void moveLeft(qreal pos)/+ noexcept+/
462     { xp = pos; }
463     pragma(inline, true) void moveTop(qreal pos)/+ noexcept+/
464     { yp = pos; }
465     pragma(inline, true) void moveRight(qreal pos)/+ noexcept+/
466     { xp = pos - w; }
467     pragma(inline, true) void moveBottom(qreal pos)/+ noexcept+/
468     { yp = pos - h; }
469     pragma(inline, true) void moveTopLeft(ref const(QPointF) p)/+ noexcept+/
470     { moveLeft(p.x()); moveTop(p.y()); }
471     pragma(inline, true) void moveBottomRight(ref const(QPointF) p)/+ noexcept+/
472     { moveRight(p.x()); moveBottom(p.y()); }
473     pragma(inline, true) void moveTopRight(ref const(QPointF) p)/+ noexcept+/
474     { moveRight(p.x()); moveTop(p.y()); }
475     pragma(inline, true) void moveBottomLeft(ref const(QPointF) p)/+ noexcept+/
476     { moveLeft(p.x()); moveBottom(p.y()); }
477     pragma(inline, true) void moveCenter(ref const(QPointF) p)/+ noexcept+/
478     { xp = p.x() - w/2; yp = p.y() - h/2; }
479 
480     pragma(inline, true) void translate(qreal dx, qreal dy)/+ noexcept+/
481     {
482         xp += dx;
483         yp += dy;
484     }
485     pragma(inline, true) void translate(ref const(QPointF) p)/+ noexcept+/
486     {
487         xp += p.x();
488         yp += p.y();
489     }
490 
491     /+ [[nodiscard]] +/ pragma(inline, true) QRectF translated(qreal dx, qreal dy) const/+ noexcept+/
492     {
493         return QRectF(xp + dx, yp + dy, w, h);
494     }
495     /+ [[nodiscard]] +/ pragma(inline, true) QRectF translated(ref const(QPointF) p) const/+ noexcept+/
496     { return QRectF(xp + p.x(), yp + p.y(), w, h); }
497 
498     /+ [[nodiscard]] +/ pragma(inline, true) QRectF transposed() const/+ noexcept+/
499     { auto tmp = topLeft(); auto tmp__1 = size().transposed(); return QRectF(tmp, tmp__1); }
500 
501     pragma(inline, true) void moveTo(qreal ax, qreal ay)/+ noexcept+/
502     {
503         xp = ax;
504         yp = ay;
505     }
506     pragma(inline, true) void moveTo(ref const(QPointF) p)/+ noexcept+/
507     {
508         xp = p.x();
509         yp = p.y();
510     }
511 
512     pragma(inline, true) void setRect(qreal ax, qreal ay, qreal aaw, qreal aah)/+ noexcept+/
513     {
514         this.xp = ax;
515         this.yp = ay;
516         this.w = aaw;
517         this.h = aah;
518     }
519     pragma(inline, true) void getRect(qreal* ax, qreal* ay, qreal* aaw, qreal* aah) const
520     {
521         *ax = this.xp;
522         *ay = this.yp;
523         *aaw = this.w;
524         *aah = this.h;
525     }
526 
527     pragma(inline, true) void setCoords(qreal xp1, qreal yp1, qreal xp2, qreal yp2)/+ noexcept+/
528     {
529         xp = xp1;
530         yp = yp1;
531         w = xp2 - xp1;
532         h = yp2 - yp1;
533     }
534     pragma(inline, true) void getCoords(qreal* xp1, qreal* yp1, qreal* xp2, qreal* yp2) const
535     {
536         *xp1 = xp;
537         *yp1 = yp;
538         *xp2 = xp + w;
539         *yp2 = yp + h;
540     }
541 
542     pragma(inline, true) void adjust(qreal xp1, qreal yp1, qreal xp2, qreal yp2)/+ noexcept+/
543     {
544         xp += xp1;
545         yp += yp1;
546         w += xp2 - xp1;
547         h += yp2 - yp1;
548     }
549     /+ [[nodiscard]] +/ pragma(inline, true) QRectF adjusted(qreal xp1, qreal yp1, qreal xp2, qreal yp2) const/+ noexcept+/
550     {
551         return QRectF(xp + xp1, yp + yp1, w + xp2 - xp1, h + yp2 - yp1);
552     }
553 
554     pragma(inline, true) QSizeF size() const/+ noexcept+/
555     { return QSizeF(w, h); }
556     pragma(inline, true) qreal width() const/+ noexcept+/
557     { return w; }
558     pragma(inline, true) qreal height() const/+ noexcept+/
559     { return h; }
560     pragma(inline, true) void setWidth(qreal aw)/+ noexcept+/
561     { this.w = aw; }
562     pragma(inline, true) void setHeight(qreal ah)/+ noexcept+/
563     { this.h = ah; }
564     pragma(inline, true) void setSize(ref const(QSizeF) s)/+ noexcept+/
565     {
566         w = s.width();
567         h = s.height();
568     }
569 
570     QRectF opBinary(string op)(ref const(QRectF) r) const/+ noexcept+/ if(op == "|");
571     QRectF opBinary(string op)(ref const(QRectF) r) const/+ noexcept+/ if(op == "&");
572     pragma(inline, true) ref QRectF opOpAssign(string op)(ref const(QRectF) r)/+ noexcept+/ if(op == "|")
573     {
574         this = this | r;
575         return this;
576     }
577     pragma(inline, true) ref QRectF opOpAssign(string op)(ref const(QRectF) r)/+ noexcept+/ if(op == "&")
578     {
579         this = this & r;
580         return this;
581     }
582 
583     bool contains(ref const(QRectF) r) const/+ noexcept+/;
584     bool contains(ref const(QPointF) p) const/+ noexcept+/;
585     pragma(inline, true) bool contains(qreal ax, qreal ay) const/+ noexcept+/
586     {
587         auto tmp = QPointF(ax, ay); return contains(tmp);
588     }
589     /+ [[nodiscard]] +/ pragma(inline, true) QRectF united(ref const(QRectF) r) const/+ noexcept+/
590     {
591         return this | r;
592     }
593     /+ [[nodiscard]] +/ pragma(inline, true) QRectF intersected(ref const(QRectF) r) const/+ noexcept+/
594     {
595         return this & r;
596     }
597     bool intersects(ref const(QRectF) r) const/+ noexcept+/;
598 
599     pragma(inline, true) QRectF marginsAdded(ref const(QMarginsF) margins) const/+ noexcept+/
600     {
601         auto tmp = QPointF(xp - margins.left(), yp - margins.top()); auto tmp__1 = QSizeF(w + margins.left() + margins.right(), h + margins.top() + margins.bottom()); return QRectF(tmp,
602                       tmp__1);
603     }
604     pragma(inline, true) QRectF marginsRemoved(ref const(QMarginsF) margins) const/+ noexcept+/
605     {
606         auto tmp = QPointF(xp + margins.left(), yp + margins.top()); auto tmp__1 = QSizeF(w - margins.left() - margins.right(), h - margins.top() - margins.bottom()); return QRectF(tmp,
607                       tmp__1);
608     }
609     pragma(inline, true) ref QRectF opOpAssign(string op)(ref const(QMarginsF) margins)/+ noexcept+/ if(op == "+")
610     {
611         this = marginsAdded(margins);
612         return this;
613     }
614     pragma(inline, true) ref QRectF opOpAssign(string op)(ref const(QMarginsF) margins)/+ noexcept+/ if(op == "-")
615     {
616         this = marginsRemoved(margins);
617         return this;
618     }
619 
620     /+ friend constexpr inline bool operator==(const QRectF &r1, const QRectF &r2) noexcept
621     {
622         return r1.topLeft() == r2.topLeft()
623             && r1.size() == r2.size();
624     } +/
625     /+ friend constexpr inline bool operator!=(const QRectF &r1, const QRectF &r2) noexcept
626     {
627         return r1.topLeft() != r2.topLeft()
628             || r1.size() != r2.size();
629     } +/
630 
631     /+ [[nodiscard]] +/ pragma(inline, true) QRect toRect() const/+ noexcept+/
632     {
633         // This rounding is designed to minimize the maximum possible difference
634         // in topLeft(), bottomRight(), and size() after rounding.
635         // All dimensions are at most off by 0.75, and topLeft by at most 0.5.
636         const(int) nxp = qRound(xp);
637         const(int) nyp = qRound(yp);
638         const(int) nw = qRound(w + (xp - nxp) / 2);
639         const(int) nh = qRound(h + (yp - nyp) / 2);
640         return QRect(nxp, nyp, nw, nh);
641     }
642     /+ [[nodiscard]] +/ QRect toAlignedRect() const/+ noexcept+/;
643 
644     static if((versionIsSet!("OSX") || versionIsSet!("iOS") || versionIsSet!("TVOS") || versionIsSet!("WatchOS")))
645     {
646         /+ [[nodiscard]] static QRectF fromCGRect(CGRect rect) noexcept; +/
647         /+ [[nodiscard]] CGRect toCGRect() const noexcept; +/
648     }
649 
650 private:
651     qreal xp = 0.;
652     qreal yp = 0.;
653     qreal w = 0.;
654     qreal h = 0.;
655     mixin(CREATE_CONVENIENCE_WRAPPERS);
656 }
657 /+ Q_DECLARE_TYPEINFO(QRectF, Q_RELOCATABLE_TYPE);
658 
659 
660 /*****************************************************************************
661   QRectF stream functions
662  *****************************************************************************/
663 #ifndef QT_NO_DATASTREAM
664 Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QRectF &);
665 Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QRectF &);
666 #endif
667 
668 /*****************************************************************************
669   QRectF inline member functions
670  *****************************************************************************/
671 
672 
673 QT_WARNING_PUSH
674 QT_WARNING_DISABLE_FLOAT_COMPARE
675 
676 QT_WARNING_POP +/
677 
678 /+pragma(inline, true) QRectF operator +(ref const(QRectF) lhs, ref const(QMarginsF) rhs)/+ noexcept+/
679 {
680     auto tmp = QPointF(lhs.left() - rhs.left(), lhs.top() - rhs.top()); auto tmp__1 = QSizeF(lhs.width() + rhs.left() + rhs.right(), lhs.height() + rhs.top() + rhs.bottom()); return QRectF(tmp,
681                   tmp__1);
682 }+/
683 
684 /+pragma(inline, true) QRectF operator +(ref const(QMarginsF) lhs, ref const(QRectF) rhs)/+ noexcept+/
685 {
686     auto tmp = QPointF(rhs.left() - lhs.left(), rhs.top() - lhs.top()); auto tmp__1 = QSizeF(rhs.width() + lhs.left() + lhs.right(), rhs.height() + lhs.top() + lhs.bottom()); return QRectF(tmp,
687                   tmp__1);
688 }+/
689 
690 /+pragma(inline, true) QRectF operator -(ref const(QRectF) lhs, ref const(QMarginsF) rhs)/+ noexcept+/
691 {
692     auto tmp = QPointF(lhs.left() + rhs.left(), lhs.top() + rhs.top()); auto tmp__1 = QSizeF(lhs.width() - rhs.left() - rhs.right(), lhs.height() - rhs.top() - rhs.bottom()); return QRectF(tmp,
693                   tmp__1);
694 }+/
695 
696 /+ #ifndef QT_NO_DEBUG_STREAM
697 Q_CORE_EXPORT QDebug operator<<(QDebug, const QRectF &);
698 #endif +/
699