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