qpoint.sip 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. // qpoint.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 <qpoint.h>
  23. %End
  24. class QPoint
  25. {
  26. %TypeHeaderCode
  27. #include <qpoint.h>
  28. %End
  29. %PickleCode
  30. sipRes = Py_BuildValue("ii", sipCpp->x(), sipCpp->y());
  31. %End
  32. public:
  33. int manhattanLength() const;
  34. QPoint();
  35. QPoint(int xpos, int ypos);
  36. SIP_PYOBJECT __repr__() const /TypeHint="str"/;
  37. %MethodCode
  38. if (sipCpp->isNull())
  39. {
  40. sipRes = PyUnicode_FromString("PyQt6.QtCore.QPoint()");
  41. }
  42. else
  43. {
  44. sipRes = PyUnicode_FromFormat(
  45. "PyQt6.QtCore.QPoint(%i, %i)", sipCpp->x(), sipCpp->y());
  46. }
  47. %End
  48. bool isNull() const;
  49. int __bool__() const;
  50. %MethodCode
  51. sipRes = !sipCpp->isNull();
  52. %End
  53. Py_hash_t __hash__() const;
  54. %MethodCode
  55. sipRes = qHash(*sipCpp);
  56. %End
  57. int x() const;
  58. int y() const;
  59. void setX(int xpos);
  60. void setY(int ypos);
  61. QPoint &operator+=(const QPoint &p);
  62. QPoint &operator-=(const QPoint &p);
  63. QPoint &operator*=(int c /Constrained/);
  64. QPoint &operator*=(double c);
  65. QPoint &operator/=(qreal c);
  66. static int dotProduct(const QPoint &p1, const QPoint &p2);
  67. QPoint transposed() const;
  68. %If (Qt_6_4_0 -)
  69. QPointF toPointF() const;
  70. %End
  71. };
  72. QDataStream &operator<<(QDataStream &, const QPoint &) /ReleaseGIL/;
  73. QDataStream &operator>>(QDataStream &, QPoint & /Constrained/) /ReleaseGIL/;
  74. %If (Qt_6_8_0 -)
  75. bool operator==(const QPointF &lhs, const QPoint &rhs);
  76. %End
  77. %If (Qt_6_8_0 -)
  78. bool operator==(const QPoint &lhs, const QPointF &rhs);
  79. %End
  80. bool operator==(const QPoint &p1, const QPoint &p2);
  81. %If (Qt_6_8_0 -)
  82. bool operator!=(const QPointF &lhs, const QPoint &rhs);
  83. %End
  84. %If (Qt_6_8_0 -)
  85. bool operator!=(const QPoint &lhs, const QPointF &rhs);
  86. %End
  87. bool operator!=(const QPoint &p1, const QPoint &p2);
  88. QPoint operator+(const QPoint &p);
  89. QPoint operator+(const QPoint &p1, const QPoint &p2);
  90. QPoint operator-(const QPoint &p);
  91. QPoint operator-(const QPoint &p1, const QPoint &p2);
  92. QPoint operator*(const QPoint &p, int factor /Constrained/);
  93. QPoint operator*(int factor /Constrained/, const QPoint &p);
  94. QPoint operator*(const QPoint &p, double factor);
  95. QPoint operator*(double factor, const QPoint &p);
  96. QPoint operator/(const QPoint &p, qreal c);
  97. class QPointF
  98. {
  99. %TypeHeaderCode
  100. #include <qpoint.h>
  101. %End
  102. %PickleCode
  103. sipRes = Py_BuildValue("dd", sipCpp->x(), sipCpp->y());
  104. %End
  105. public:
  106. QPointF();
  107. QPointF(qreal xpos, qreal ypos);
  108. QPointF(const QPoint &p);
  109. SIP_PYOBJECT __repr__() const /TypeHint="str"/;
  110. %MethodCode
  111. if (sipCpp->isNull())
  112. {
  113. sipRes = PyUnicode_FromString("PyQt6.QtCore.QPointF()");
  114. }
  115. else
  116. {
  117. PyObject *x = PyFloat_FromDouble(sipCpp->x());
  118. PyObject *y = PyFloat_FromDouble(sipCpp->y());
  119. if (x && y)
  120. sipRes = PyUnicode_FromFormat("PyQt6.QtCore.QPointF(%R, %R)", x, y);
  121. Py_XDECREF(x);
  122. Py_XDECREF(y);
  123. }
  124. %End
  125. bool isNull() const;
  126. int __bool__() const;
  127. %MethodCode
  128. sipRes = !sipCpp->isNull();
  129. %End
  130. qreal x() const;
  131. qreal y() const;
  132. void setX(qreal xpos);
  133. void setY(qreal ypos);
  134. QPointF &operator+=(const QPointF &p);
  135. QPointF &operator-=(const QPointF &p);
  136. QPointF &operator*=(qreal c);
  137. QPointF &operator/=(qreal c);
  138. QPoint toPoint() const;
  139. qreal manhattanLength() const;
  140. static qreal dotProduct(const QPointF &p1, const QPointF &p2);
  141. QPointF transposed() const;
  142. };
  143. QDataStream &operator<<(QDataStream &, const QPointF &) /ReleaseGIL/;
  144. QDataStream &operator>>(QDataStream &, QPointF & /Constrained/) /ReleaseGIL/;
  145. bool operator==(const QPointF &p1, const QPointF &p2);
  146. bool operator!=(const QPointF &p1, const QPointF &p2);
  147. QPointF operator+(const QPointF &p);
  148. QPointF operator+(const QPointF &p1, const QPointF &p2);
  149. QPointF operator-(const QPointF &p);
  150. QPointF operator-(const QPointF &p1, const QPointF &p2);
  151. QPointF operator*(const QPointF &p, qreal c);
  152. QPointF operator*(qreal c, const QPointF &p);
  153. QPointF operator/(const QPointF &p, qreal divisor);
  154. %If (Qt_6_8_0 -)
  155. bool qFuzzyCompare(const QPointF &p1, const QPointF &p2);
  156. %End
  157. %If (Qt_6_8_0 -)
  158. bool qFuzzyIsNull(const QPointF &point);
  159. %End