qrect.sip 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. // qrect.sip generated by MetaSIP
  2. //
  3. // This file is part of the QtCore Python extension module.
  4. //
  5. // Copyright (c) 2026 Riverbank Computing Limited <info@riverbankcomputing.com>
  6. //
  7. // This file is part of PyQt6.
  8. //
  9. // This file may be used under the terms of the GNU General Public License
  10. // version 3.0 as published by the Free Software Foundation and appearing in
  11. // the file LICENSE included in the packaging of this file. Please review the
  12. // following information to ensure the GNU General Public License version 3.0
  13. // requirements will be met: http://www.gnu.org/copyleft/gpl.html.
  14. //
  15. // If you do not wish to use this file under the terms of the GPL version 3.0
  16. // then you may purchase a commercial license. For more information contact
  17. // info@riverbankcomputing.com.
  18. //
  19. // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
  20. // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  21. %ModuleCode
  22. #include <qrect.h>
  23. %End
  24. class QRect
  25. {
  26. %TypeHeaderCode
  27. #include <qrect.h>
  28. %End
  29. %PickleCode
  30. sipRes = Py_BuildValue("iiii", sipCpp->x(), sipCpp->y(), sipCpp->width(), sipCpp->height());
  31. %End
  32. public:
  33. QRect();
  34. QRect normalized() const;
  35. void moveCenter(const QPoint &p);
  36. QRect operator|(const QRect &r) const;
  37. QRect operator&(const QRect &r) const;
  38. bool contains(const QPoint &point, bool proper = false) const;
  39. int __contains__(const QPoint &p) const;
  40. %MethodCode
  41. sipRes = sipCpp->contains(*a0);
  42. %End
  43. bool contains(const QRect &rectangle, bool proper = false) const;
  44. int __contains__(const QRect &r) const;
  45. %MethodCode
  46. sipRes = sipCpp->contains(*a0);
  47. %End
  48. bool intersects(const QRect &r) const;
  49. QRect(int aleft, int atop, int awidth, int aheight);
  50. QRect(const QPoint &atopLeft, const QPoint &abottomRight);
  51. QRect(const QPoint &atopLeft, const QSize &asize);
  52. SIP_PYOBJECT __repr__() const /TypeHint="str"/;
  53. %MethodCode
  54. if (sipCpp->isNull())
  55. {
  56. sipRes = PyUnicode_FromString("PyQt6.QtCore.QRect()");
  57. }
  58. else
  59. {
  60. sipRes = PyUnicode_FromFormat(
  61. "PyQt6.QtCore.QRect(%i, %i, %i, %i)", sipCpp->left(),
  62. sipCpp->top(), sipCpp->width(), sipCpp->height());
  63. }
  64. %End
  65. bool isNull() const;
  66. bool isEmpty() const;
  67. bool isValid() const;
  68. int __bool__() const;
  69. %MethodCode
  70. sipRes = sipCpp->isValid();
  71. %End
  72. Py_hash_t __hash__() const;
  73. %MethodCode
  74. sipRes = qHash(*sipCpp);
  75. %End
  76. int left() const;
  77. int top() const;
  78. int right() const;
  79. int bottom() const;
  80. int x() const;
  81. int y() const;
  82. void setLeft(int pos);
  83. void setTop(int pos);
  84. void setRight(int pos);
  85. void setBottom(int pos);
  86. void setTopLeft(const QPoint &p);
  87. void setBottomRight(const QPoint &p);
  88. void setTopRight(const QPoint &p);
  89. void setBottomLeft(const QPoint &p);
  90. void setX(int ax);
  91. void setY(int ay);
  92. QPoint topLeft() const;
  93. QPoint bottomRight() const;
  94. QPoint topRight() const;
  95. QPoint bottomLeft() const;
  96. QPoint center() const;
  97. int width() const;
  98. int height() const;
  99. QSize size() const;
  100. void translate(int dx, int dy);
  101. void translate(const QPoint &p);
  102. QRect translated(int dx, int dy) const;
  103. QRect translated(const QPoint &p) const;
  104. void moveTo(int ax, int ay);
  105. void moveTo(const QPoint &p);
  106. void moveLeft(int pos);
  107. void moveTop(int pos);
  108. void moveRight(int pos);
  109. void moveBottom(int pos);
  110. void moveTopLeft(const QPoint &p);
  111. void moveBottomRight(const QPoint &p);
  112. void moveTopRight(const QPoint &p);
  113. void moveBottomLeft(const QPoint &p);
  114. void getRect(int *ax, int *ay, int *aw, int *ah) const;
  115. void setRect(int ax, int ay, int aw, int ah);
  116. void getCoords(int *xp1, int *yp1, int *xp2, int *yp2) const;
  117. void setCoords(int xp1, int yp1, int xp2, int yp2);
  118. QRect adjusted(int xp1, int yp1, int xp2, int yp2) const;
  119. void adjust(int dx1, int dy1, int dx2, int dy2);
  120. void setWidth(int w);
  121. void setHeight(int h);
  122. void setSize(const QSize &s);
  123. bool contains(int ax, int ay, bool aproper) const;
  124. bool contains(int ax, int ay) const;
  125. QRect &operator|=(const QRect &r);
  126. QRect &operator&=(const QRect &r);
  127. QRect intersected(const QRect &other) const;
  128. QRect united(const QRect &r) const;
  129. QRect marginsAdded(const QMargins &margins) const;
  130. QRect marginsRemoved(const QMargins &margins) const;
  131. QRect &operator+=(const QMargins &margins);
  132. QRect &operator-=(const QMargins &margins);
  133. QRect transposed() const;
  134. static QRect span(const QPoint &p1, const QPoint &p2);
  135. %If (Qt_6_4_0 -)
  136. QRectF toRectF() const;
  137. %End
  138. };
  139. QDataStream &operator<<(QDataStream &, const QRect &) /ReleaseGIL/;
  140. QDataStream &operator>>(QDataStream &, QRect & /Constrained/) /ReleaseGIL/;
  141. %If (Qt_6_8_0 -)
  142. bool operator==(const QRectF &lhs, const QRect &rhs);
  143. %End
  144. %If (Qt_6_8_0 -)
  145. bool operator==(const QRect &lhs, const QRectF &rhs);
  146. %End
  147. bool operator==(const QRect &r1, const QRect &r2);
  148. %If (Qt_6_8_0 -)
  149. bool operator!=(const QRectF &lhs, const QRect &rhs);
  150. %End
  151. %If (Qt_6_8_0 -)
  152. bool operator!=(const QRect &lhs, const QRectF &rhs);
  153. %End
  154. bool operator!=(const QRect &r1, const QRect &r2);
  155. class QRectF
  156. {
  157. %TypeHeaderCode
  158. #include <qrect.h>
  159. %End
  160. %PickleCode
  161. sipRes = Py_BuildValue("dddd", sipCpp->x(), sipCpp->y(), sipCpp->width(), sipCpp->height());
  162. %End
  163. public:
  164. QRectF();
  165. QRectF(const QPointF &atopLeft, const QSizeF &asize);
  166. QRectF(const QPointF &atopLeft, const QPointF &abottomRight);
  167. QRectF(qreal aleft, qreal atop, qreal awidth, qreal aheight);
  168. QRectF(const QRect &r);
  169. SIP_PYOBJECT __repr__() const /TypeHint="str"/;
  170. %MethodCode
  171. if (sipCpp->isNull())
  172. {
  173. sipRes = PyUnicode_FromString("PyQt6.QtCore.QRectF()");
  174. }
  175. else
  176. {
  177. PyObject *l = PyFloat_FromDouble(sipCpp->left());
  178. PyObject *t = PyFloat_FromDouble(sipCpp->top());
  179. PyObject *w = PyFloat_FromDouble(sipCpp->width());
  180. PyObject *h = PyFloat_FromDouble(sipCpp->height());
  181. if (l && t && w && h)
  182. sipRes = PyUnicode_FromFormat(
  183. "PyQt6.QtCore.QRectF(%R, %R, %R, %R)", l, t, w, h);
  184. Py_XDECREF(l);
  185. Py_XDECREF(t);
  186. Py_XDECREF(w);
  187. Py_XDECREF(h);
  188. }
  189. %End
  190. QRectF normalized() const;
  191. qreal left() const;
  192. qreal top() const;
  193. qreal right() const;
  194. qreal bottom() const;
  195. void setX(qreal pos);
  196. void setY(qreal pos);
  197. QPointF topLeft() const;
  198. QPointF bottomRight() const;
  199. QPointF topRight() const;
  200. QPointF bottomLeft() const;
  201. QRectF operator|(const QRectF &r) const;
  202. QRectF operator&(const QRectF &r) const;
  203. bool contains(const QPointF &p) const;
  204. int __contains__(const QPointF &p) const;
  205. %MethodCode
  206. sipRes = sipCpp->contains(*a0);
  207. %End
  208. bool contains(const QRectF &r) const;
  209. int __contains__(const QRectF &r) const;
  210. %MethodCode
  211. sipRes = sipCpp->contains(*a0);
  212. %End
  213. bool intersects(const QRectF &r) const;
  214. bool isNull() const;
  215. bool isEmpty() const;
  216. bool isValid() const;
  217. int __bool__() const;
  218. %MethodCode
  219. sipRes = sipCpp->isValid();
  220. %End
  221. qreal x() const;
  222. qreal y() const;
  223. void setLeft(qreal pos);
  224. void setRight(qreal pos);
  225. void setTop(qreal pos);
  226. void setBottom(qreal pos);
  227. void setTopLeft(const QPointF &p);
  228. void setTopRight(const QPointF &p);
  229. void setBottomLeft(const QPointF &p);
  230. void setBottomRight(const QPointF &p);
  231. QPointF center() const;
  232. void moveLeft(qreal pos);
  233. void moveTop(qreal pos);
  234. void moveRight(qreal pos);
  235. void moveBottom(qreal pos);
  236. void moveTopLeft(const QPointF &p);
  237. void moveTopRight(const QPointF &p);
  238. void moveBottomLeft(const QPointF &p);
  239. void moveBottomRight(const QPointF &p);
  240. void moveCenter(const QPointF &p);
  241. qreal width() const;
  242. qreal height() const;
  243. QSizeF size() const;
  244. void translate(qreal dx, qreal dy);
  245. void translate(const QPointF &p);
  246. void moveTo(qreal ax, qreal ay);
  247. void moveTo(const QPointF &p);
  248. QRectF translated(qreal dx, qreal dy) const;
  249. QRectF translated(const QPointF &p) const;
  250. void getRect(qreal *ax, qreal *ay, qreal *aaw, qreal *aah) const;
  251. void setRect(qreal ax, qreal ay, qreal aaw, qreal aah);
  252. void getCoords(qreal *xp1, qreal *yp1, qreal *xp2, qreal *yp2) const;
  253. void setCoords(qreal xp1, qreal yp1, qreal xp2, qreal yp2);
  254. void adjust(qreal xp1, qreal yp1, qreal xp2, qreal yp2);
  255. QRectF adjusted(qreal xp1, qreal yp1, qreal xp2, qreal yp2) const;
  256. void setWidth(qreal aw);
  257. void setHeight(qreal ah);
  258. void setSize(const QSizeF &s);
  259. bool contains(qreal ax, qreal ay) const;
  260. QRectF &operator|=(const QRectF &r);
  261. QRectF &operator&=(const QRectF &r);
  262. QRectF intersected(const QRectF &r) const;
  263. QRectF united(const QRectF &r) const;
  264. QRect toAlignedRect() const;
  265. QRect toRect() const;
  266. QRectF marginsAdded(const QMarginsF &margins) const;
  267. QRectF marginsRemoved(const QMarginsF &margins) const;
  268. QRectF &operator+=(const QMarginsF &margins);
  269. QRectF &operator-=(const QMarginsF &margins);
  270. QRectF transposed() const;
  271. };
  272. QDataStream &operator<<(QDataStream &, const QRectF &) /ReleaseGIL/;
  273. QDataStream &operator>>(QDataStream &, QRectF & /Constrained/) /ReleaseGIL/;
  274. bool operator==(const QRectF &r1, const QRectF &r2);
  275. bool operator!=(const QRectF &r1, const QRectF &r2);
  276. QRect operator+(const QRect &rectangle, const QMargins &margins);
  277. QRect operator+(const QMargins &margins, const QRect &rectangle);
  278. QRect operator-(const QRect &lhs, const QMargins &rhs);
  279. QRectF operator+(const QRectF &lhs, const QMarginsF &rhs);
  280. QRectF operator+(const QMarginsF &lhs, const QRectF &rhs);
  281. QRectF operator-(const QRectF &lhs, const QMarginsF &rhs);
  282. %If (Qt_6_8_0 -)
  283. bool qFuzzyCompare(const QRectF &lhs, const QRectF &rhs);
  284. %End
  285. %If (Qt_6_8_0 -)
  286. bool qFuzzyIsNull(const QRectF &rect);
  287. %End