qcursor.sip 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. // qcursor.sip generated by MetaSIP
  2. //
  3. // This file is part of the QtGui 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. class QCursor /TypeHintIn="Union[QCursor, Qt.CursorShape]"/
  22. {
  23. %TypeHeaderCode
  24. #include <qcursor.h>
  25. %End
  26. %ConvertToTypeCode
  27. // SIP doesn't support automatic type convertors so we explicitly allow a
  28. // Qt::CursorShape to be used whenever a QCursor is expected.
  29. bool is_cursor_shape = true;
  30. int cursor_shape = sipConvertToEnum(sipPy, sipType_Qt_CursorShape);
  31. if (PyErr_Occurred())
  32. {
  33. PyErr_Clear();
  34. is_cursor_shape = false;
  35. }
  36. if (sipIsErr == NULL)
  37. return (is_cursor_shape ||
  38. sipCanConvertToType(sipPy, sipType_QCursor, SIP_NO_CONVERTORS));
  39. if (is_cursor_shape)
  40. {
  41. *sipCppPtr = new QCursor(static_cast<Qt::CursorShape>(cursor_shape));
  42. return sipGetState(sipTransferObj);
  43. }
  44. *sipCppPtr = reinterpret_cast<QCursor *>(sipConvertToType(sipPy, sipType_QCursor, sipTransferObj, SIP_NO_CONVERTORS, 0, sipIsErr));
  45. return 0;
  46. %End
  47. public:
  48. QCursor();
  49. QCursor(const QBitmap &bitmap, const QBitmap &mask, int hotX = -1, int hotY = -1);
  50. QCursor(const QPixmap &pixmap, int hotX = -1, int hotY = -1);
  51. QCursor(const QCursor &cursor);
  52. QCursor(const QVariant &variant /GetWrapper/) /NoDerived/;
  53. %MethodCode
  54. if (a0->canConvert<QCursor>())
  55. sipCpp = new QCursor(a0->value<QCursor>());
  56. else
  57. sipError = sipBadCallableArg(0, a0Wrapper);
  58. %End
  59. ~QCursor();
  60. Qt::CursorShape shape() const;
  61. void setShape(Qt::CursorShape newShape);
  62. QBitmap bitmap() const;
  63. QBitmap mask() const;
  64. QPixmap pixmap() const;
  65. QPoint hotSpot() const;
  66. static QPoint pos();
  67. static void setPos(int x, int y);
  68. static void setPos(const QPoint &p);
  69. static QPoint pos(const QScreen *screen);
  70. static void setPos(QScreen *screen, int x, int y);
  71. static void setPos(QScreen *screen, const QPoint &p);
  72. void swap(QCursor &other);
  73. };
  74. QDataStream &operator<<(QDataStream &outS, const QCursor &cursor) /ReleaseGIL/;
  75. QDataStream &operator>>(QDataStream &inS, QCursor &cursor /Constrained/) /ReleaseGIL/;
  76. bool operator==(const QCursor &lhs, const QCursor &rhs);
  77. bool operator!=(const QCursor &lhs, const QCursor &rhs);