1// qrect.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 QRect 24{ 25%TypeHeaderCode 26#include <qrect.h> 27%End 28 29%PickleCode 30 sipRes = Py_BuildValue((char *)"iiii", sipCpp->x(), sipCpp->y(), sipCpp->width(), sipCpp->height()); 31%End 32 33public: 34 QRect(); 35 QRect normalized() const; 36 void moveCenter(const QPoint &p); 37 QRect operator|(const QRect &r) const; 38 QRect operator&(const QRect &r) const; 39 bool contains(const QPoint &point, bool proper = false) const; 40 int __contains__(const QPoint &p) const; 41%MethodCode 42 sipRes = sipCpp->contains(*a0); 43%End 44 45 bool contains(const QRect &rectangle, bool proper = false) const; 46 int __contains__(const QRect &r) const; 47%MethodCode 48 sipRes = sipCpp->contains(*a0); 49%End 50 51 bool intersects(const QRect &r) const; 52 QRect(int aleft, int atop, int awidth, int aheight); 53 QRect(const QPoint &atopLeft, const QPoint &abottomRight); 54 QRect(const QPoint &atopLeft, const QSize &asize); 55 SIP_PYOBJECT __repr__() const /TypeHint="str"/; 56%MethodCode 57 if (sipCpp->isNull()) 58 { 59 #if PY_MAJOR_VERSION >= 3 60 sipRes = PyUnicode_FromString("PyQt5.QtCore.QRect()"); 61 #else 62 sipRes = PyString_FromString("PyQt5.QtCore.QRect()"); 63 #endif 64 } 65 else 66 { 67 sipRes = 68 #if PY_MAJOR_VERSION >= 3 69 PyUnicode_FromFormat 70 #else 71 PyString_FromFormat 72 #endif 73 ("PyQt5.QtCore.QRect(%i, %i, %i, %i)", sipCpp->left(), 74 sipCpp->top(), sipCpp->width(), sipCpp->height()); 75 } 76%End 77 78 bool isNull() const; 79 bool isEmpty() const; 80 bool isValid() const; 81 int __bool__() const; 82%MethodCode 83 sipRes = sipCpp->isValid(); 84%End 85 86 int left() const; 87 int top() const; 88 int right() const; 89 int bottom() const; 90 int x() const; 91 int y() const; 92 void setLeft(int pos); 93 void setTop(int pos); 94 void setRight(int pos); 95 void setBottom(int pos); 96 void setTopLeft(const QPoint &p); 97 void setBottomRight(const QPoint &p); 98 void setTopRight(const QPoint &p); 99 void setBottomLeft(const QPoint &p); 100 void setX(int ax); 101 void setY(int ay); 102 QPoint topLeft() const; 103 QPoint bottomRight() const; 104 QPoint topRight() const; 105 QPoint bottomLeft() const; 106 QPoint center() const; 107 int width() const; 108 int height() const; 109 QSize size() const; 110 void translate(int dx, int dy); 111 void translate(const QPoint &p); 112 QRect translated(int dx, int dy) const; 113 QRect translated(const QPoint &p) const; 114 void moveTo(int ax, int ay); 115 void moveTo(const QPoint &p); 116 void moveLeft(int pos); 117 void moveTop(int pos); 118 void moveRight(int pos); 119 void moveBottom(int pos); 120 void moveTopLeft(const QPoint &p); 121 void moveBottomRight(const QPoint &p); 122 void moveTopRight(const QPoint &p); 123 void moveBottomLeft(const QPoint &p); 124 void getRect(int *ax, int *ay, int *aw, int *ah) const; 125 void setRect(int ax, int ay, int aw, int ah); 126 void getCoords(int *xp1, int *yp1, int *xp2, int *yp2) const; 127 void setCoords(int xp1, int yp1, int xp2, int yp2); 128 QRect adjusted(int xp1, int yp1, int xp2, int yp2) const; 129 void adjust(int dx1, int dy1, int dx2, int dy2); 130 void setWidth(int w); 131 void setHeight(int h); 132 void setSize(const QSize &s); 133 bool contains(int ax, int ay, bool aproper) const; 134 bool contains(int ax, int ay) const; 135 QRect &operator|=(const QRect &r); 136 QRect &operator&=(const QRect &r); 137 QRect intersected(const QRect &other) const; 138 QRect united(const QRect &r) const; 139%If (Qt_5_1_0 -) 140 QRect marginsAdded(const QMargins &margins) const; 141%End 142%If (Qt_5_1_0 -) 143 QRect marginsRemoved(const QMargins &margins) const; 144%End 145%If (Qt_5_1_0 -) 146 QRect &operator+=(const QMargins &margins); 147%End 148%If (Qt_5_1_0 -) 149 QRect &operator-=(const QMargins &margins); 150%End 151%If (Qt_5_7_0 -) 152 QRect transposed() const; 153%End 154}; 155 156QDataStream &operator<<(QDataStream &, const QRect & /Constrained/) /ReleaseGIL/; 157QDataStream &operator>>(QDataStream &, QRect & /Constrained/) /ReleaseGIL/; 158bool operator==(const QRect &r1, const QRect &r2); 159bool operator!=(const QRect &r1, const QRect &r2); 160 161class QRectF 162{ 163%TypeHeaderCode 164#include <qrect.h> 165%End 166 167%PickleCode 168 sipRes = Py_BuildValue((char *)"dddd", sipCpp->x(), sipCpp->y(), sipCpp->width(), sipCpp->height()); 169%End 170 171public: 172 QRectF(); 173 QRectF(const QPointF &atopLeft, const QSizeF &asize); 174 QRectF(const QPointF &atopLeft, const QPointF &abottomRight); 175 QRectF(qreal aleft, qreal atop, qreal awidth, qreal aheight); 176 QRectF(const QRect &r); 177 SIP_PYOBJECT __repr__() const /TypeHint="str"/; 178%MethodCode 179 if (sipCpp->isNull()) 180 { 181 #if PY_MAJOR_VERSION >= 3 182 sipRes = PyUnicode_FromString("PyQt5.QtCore.QRectF()"); 183 #else 184 sipRes = PyString_FromString("PyQt5.QtCore.QRectF()"); 185 #endif 186 } 187 else 188 { 189 PyObject *l = PyFloat_FromDouble(sipCpp->left()); 190 PyObject *t = PyFloat_FromDouble(sipCpp->top()); 191 PyObject *w = PyFloat_FromDouble(sipCpp->width()); 192 PyObject *h = PyFloat_FromDouble(sipCpp->height()); 193 194 if (l && t && w && h) 195 { 196 #if PY_MAJOR_VERSION >= 3 197 sipRes = PyUnicode_FromFormat("PyQt5.QtCore.QRectF(%R, %R, %R, %R)", l, 198 t, w, h); 199 #else 200 sipRes = PyString_FromString("PyQt5.QtCore.QRectF("); 201 PyString_ConcatAndDel(&sipRes, PyObject_Repr(l)); 202 PyString_ConcatAndDel(&sipRes, PyString_FromString(", ")); 203 PyString_ConcatAndDel(&sipRes, PyObject_Repr(t)); 204 PyString_ConcatAndDel(&sipRes, PyString_FromString(", ")); 205 PyString_ConcatAndDel(&sipRes, PyObject_Repr(w)); 206 PyString_ConcatAndDel(&sipRes, PyString_FromString(", ")); 207 PyString_ConcatAndDel(&sipRes, PyObject_Repr(h)); 208 PyString_ConcatAndDel(&sipRes, PyString_FromString(")")); 209 #endif 210 } 211 212 Py_XDECREF(l); 213 Py_XDECREF(t); 214 Py_XDECREF(w); 215 Py_XDECREF(h); 216 } 217%End 218 219 QRectF normalized() const; 220 qreal left() const; 221 qreal top() const; 222 qreal right() const; 223 qreal bottom() const; 224 void setX(qreal pos); 225 void setY(qreal pos); 226 QPointF topLeft() const; 227 QPointF bottomRight() const; 228 QPointF topRight() const; 229 QPointF bottomLeft() const; 230 QRectF operator|(const QRectF &r) const; 231 QRectF operator&(const QRectF &r) const; 232 bool contains(const QPointF &p) const; 233 int __contains__(const QPointF &p) const; 234%MethodCode 235 sipRes = sipCpp->contains(*a0); 236%End 237 238 bool contains(const QRectF &r) const; 239 int __contains__(const QRectF &r) const; 240%MethodCode 241 sipRes = sipCpp->contains(*a0); 242%End 243 244 bool intersects(const QRectF &r) const; 245 bool isNull() const; 246 bool isEmpty() const; 247 bool isValid() const; 248 int __bool__() const; 249%MethodCode 250 sipRes = sipCpp->isValid(); 251%End 252 253 qreal x() const; 254 qreal y() const; 255 void setLeft(qreal pos); 256 void setRight(qreal pos); 257 void setTop(qreal pos); 258 void setBottom(qreal pos); 259 void setTopLeft(const QPointF &p); 260 void setTopRight(const QPointF &p); 261 void setBottomLeft(const QPointF &p); 262 void setBottomRight(const QPointF &p); 263 QPointF center() const; 264 void moveLeft(qreal pos); 265 void moveTop(qreal pos); 266 void moveRight(qreal pos); 267 void moveBottom(qreal pos); 268 void moveTopLeft(const QPointF &p); 269 void moveTopRight(const QPointF &p); 270 void moveBottomLeft(const QPointF &p); 271 void moveBottomRight(const QPointF &p); 272 void moveCenter(const QPointF &p); 273 qreal width() const; 274 qreal height() const; 275 QSizeF size() const; 276 void translate(qreal dx, qreal dy); 277 void translate(const QPointF &p); 278 void moveTo(qreal ax, qreal ay); 279 void moveTo(const QPointF &p); 280 QRectF translated(qreal dx, qreal dy) const; 281 QRectF translated(const QPointF &p) const; 282 void getRect(qreal *ax, qreal *ay, qreal *aaw, qreal *aah) const; 283 void setRect(qreal ax, qreal ay, qreal aaw, qreal aah); 284 void getCoords(qreal *xp1, qreal *yp1, qreal *xp2, qreal *yp2) const; 285 void setCoords(qreal xp1, qreal yp1, qreal xp2, qreal yp2); 286 void adjust(qreal xp1, qreal yp1, qreal xp2, qreal yp2); 287 QRectF adjusted(qreal xp1, qreal yp1, qreal xp2, qreal yp2) const; 288 void setWidth(qreal aw); 289 void setHeight(qreal ah); 290 void setSize(const QSizeF &s); 291 bool contains(qreal ax, qreal ay) const; 292 QRectF &operator|=(const QRectF &r); 293 QRectF &operator&=(const QRectF &r); 294 QRectF intersected(const QRectF &r) const; 295 QRectF united(const QRectF &r) const; 296 QRect toAlignedRect() const; 297 QRect toRect() const; 298%If (Qt_5_3_0 -) 299 QRectF marginsAdded(const QMarginsF &margins) const; 300%End 301%If (Qt_5_3_0 -) 302 QRectF marginsRemoved(const QMarginsF &margins) const; 303%End 304%If (Qt_5_3_0 -) 305 QRectF &operator+=(const QMarginsF &margins); 306%End 307%If (Qt_5_3_0 -) 308 QRectF &operator-=(const QMarginsF &margins); 309%End 310%If (Qt_5_7_0 -) 311 QRectF transposed() const; 312%End 313}; 314 315QDataStream &operator<<(QDataStream &, const QRectF & /Constrained/) /ReleaseGIL/; 316QDataStream &operator>>(QDataStream &, QRectF & /Constrained/) /ReleaseGIL/; 317bool operator==(const QRectF &r1, const QRectF &r2); 318bool operator!=(const QRectF &r1, const QRectF &r2); 319%If (Qt_5_3_0 -) 320QRect operator+(const QRect &rectangle, const QMargins &margins); 321%End 322%If (Qt_5_3_0 -) 323QRect operator+(const QMargins &margins, const QRect &rectangle); 324%End 325%If (Qt_5_3_0 -) 326QRect operator-(const QRect &lhs, const QMargins &rhs); 327%End 328%If (Qt_5_3_0 -) 329QRectF operator+(const QRectF &lhs, const QMarginsF &rhs); 330%End 331%If (Qt_5_3_0 -) 332QRectF operator+(const QMarginsF &lhs, const QRectF &rhs); 333%End 334%If (Qt_5_3_0 -) 335QRectF operator-(const QRectF &lhs, const QMarginsF &rhs); 336%End 337