1// qline.sip generated by MetaSIP 2// 3// This file is part of the QtCore Python extension module. 4// 5// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com> 6// 7// This file is part of PyQt5. 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 22 23class QLine 24{ 25%TypeHeaderCode 26#include <qline.h> 27%End 28 29%PickleCode 30 sipRes = Py_BuildValue((char *)"iiii", sipCpp->x1(), sipCpp->y1(), sipCpp->x2(), sipCpp->y2()); 31%End 32 33public: 34 bool operator!=(const QLine &d) const; 35 QLine(); 36 QLine(const QPoint &pt1_, const QPoint &pt2_); 37 QLine(int x1pos, int y1pos, int x2pos, int y2pos); 38 SIP_PYOBJECT __repr__() const /TypeHint="str"/; 39%MethodCode 40 if (sipCpp->isNull()) 41 { 42 #if PY_MAJOR_VERSION >= 3 43 sipRes = PyUnicode_FromString("PyQt5.QtCore.QLine()"); 44 #else 45 sipRes = PyString_FromString("PyQt5.QtCore.QLine()"); 46 #endif 47 } 48 else 49 { 50 sipRes = 51 #if PY_MAJOR_VERSION >= 3 52 PyUnicode_FromFormat 53 #else 54 PyString_FromFormat 55 #endif 56 ("PyQt5.QtCore.QLine(%i, %i, %i, %i)", 57 sipCpp->x1(), sipCpp->y1(), sipCpp->x2(), sipCpp->y2()); 58 } 59%End 60 61 bool isNull() const; 62 int __bool__() const; 63%MethodCode 64 sipRes = !sipCpp->isNull(); 65%End 66 67 int x1() const; 68 int y1() const; 69 int x2() const; 70 int y2() const; 71 QPoint p1() const; 72 QPoint p2() const; 73 int dx() const; 74 int dy() const; 75 void translate(const QPoint &point); 76 void translate(int adx, int ady); 77 bool operator==(const QLine &d) const; 78 QLine translated(const QPoint &p) const; 79 QLine translated(int adx, int ady) const; 80 void setP1(const QPoint &aP1); 81 void setP2(const QPoint &aP2); 82 void setPoints(const QPoint &aP1, const QPoint &aP2); 83 void setLine(int aX1, int aY1, int aX2, int aY2); 84%If (Qt_5_8_0 -) 85 QPoint center() const; 86%End 87}; 88 89QDataStream &operator<<(QDataStream &, const QLine & /Constrained/) /ReleaseGIL/; 90QDataStream &operator>>(QDataStream &, QLine & /Constrained/) /ReleaseGIL/; 91 92class QLineF 93{ 94%TypeHeaderCode 95#include <qline.h> 96%End 97 98%PickleCode 99 sipRes = Py_BuildValue((char *)"dddd", sipCpp->x1(), sipCpp->y1(), sipCpp->x2(), sipCpp->y2()); 100%End 101 102public: 103 enum IntersectType 104 { 105 NoIntersection, 106 BoundedIntersection, 107 UnboundedIntersection, 108 }; 109 110 QLineF(const QLine &line); 111 bool isNull() const; 112 int __bool__() const; 113%MethodCode 114 sipRes = !sipCpp->isNull(); 115%End 116 117 qreal length() const; 118 QLineF unitVector() const; 119 QLineF::IntersectType intersect(const QLineF &l, QPointF *intersectionPoint) const; 120%If (Qt_5_14_0 -) 121 typedef QLineF::IntersectType IntersectionType; 122%End 123%If (Qt_5_14_0 -) 124 QLineF::IntersectionType intersects(const QLineF &l, QPointF *intersectionPoint /Out/) const; 125%End 126 bool operator!=(const QLineF &d) const; 127 QLineF(); 128 QLineF(const QPointF &apt1, const QPointF &apt2); 129 QLineF(qreal x1pos, qreal y1pos, qreal x2pos, qreal y2pos); 130 SIP_PYOBJECT __repr__() const /TypeHint="str"/; 131%MethodCode 132 if (sipCpp->isNull()) 133 { 134 #if PY_MAJOR_VERSION >= 3 135 sipRes = PyUnicode_FromString("PyQt5.QtCore.QLineF()"); 136 #else 137 sipRes = PyString_FromString("PyQt5.QtCore.QLineF()"); 138 #endif 139 } 140 else 141 { 142 PyObject *x1 = PyFloat_FromDouble(sipCpp->x1()); 143 PyObject *y1 = PyFloat_FromDouble(sipCpp->y1()); 144 PyObject *x2 = PyFloat_FromDouble(sipCpp->x2()); 145 PyObject *y2 = PyFloat_FromDouble(sipCpp->y2()); 146 147 if (x1 && y1 && x2 && y2) 148 { 149 #if PY_MAJOR_VERSION >= 3 150 sipRes = PyUnicode_FromFormat("PyQt5.QtCore.QLineF(%R, %R, %R, %R)", 151 x1, y1, x2, y2); 152 #else 153 sipRes = PyString_FromString("PyQt5.QtCore.QLineF("); 154 PyString_ConcatAndDel(&sipRes, PyObject_Repr(x1)); 155 PyString_ConcatAndDel(&sipRes, PyString_FromString(", ")); 156 PyString_ConcatAndDel(&sipRes, PyObject_Repr(y1)); 157 PyString_ConcatAndDel(&sipRes, PyString_FromString(", ")); 158 PyString_ConcatAndDel(&sipRes, PyObject_Repr(x2)); 159 PyString_ConcatAndDel(&sipRes, PyString_FromString(", ")); 160 PyString_ConcatAndDel(&sipRes, PyObject_Repr(y2)); 161 PyString_ConcatAndDel(&sipRes, PyString_FromString(")")); 162 #endif 163 } 164 165 Py_XDECREF(x1); 166 Py_XDECREF(y1); 167 Py_XDECREF(x2); 168 Py_XDECREF(y2); 169 } 170%End 171 172 qreal x1() const; 173 qreal y1() const; 174 qreal x2() const; 175 qreal y2() const; 176 QPointF p1() const; 177 QPointF p2() const; 178 qreal dx() const; 179 qreal dy() const; 180 QLineF normalVector() const; 181 void translate(const QPointF &point); 182 void translate(qreal adx, qreal ady); 183 void setLength(qreal len); 184 QPointF pointAt(qreal t) const; 185 QLine toLine() const; 186 bool operator==(const QLineF &d) const; 187 static QLineF fromPolar(qreal length, qreal angle); 188 qreal angle() const; 189 void setAngle(qreal angle); 190 qreal angleTo(const QLineF &l) const; 191 QLineF translated(const QPointF &p) const; 192 QLineF translated(qreal adx, qreal ady) const; 193 void setP1(const QPointF &aP1); 194 void setP2(const QPointF &aP2); 195 void setPoints(const QPointF &aP1, const QPointF &aP2); 196 void setLine(qreal aX1, qreal aY1, qreal aX2, qreal aY2); 197%If (Qt_5_8_0 -) 198 QPointF center() const; 199%End 200}; 201 202QDataStream &operator<<(QDataStream &, const QLineF & /Constrained/) /ReleaseGIL/; 203QDataStream &operator>>(QDataStream &, QLineF & /Constrained/) /ReleaseGIL/; 204