qpen.sip 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. // qpen.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 QPen /TypeHintIn="Union[QPen, QColor]"/
  22. {
  23. %TypeHeaderCode
  24. #include <qpen.h>
  25. %End
  26. %ConvertToTypeCode
  27. // SIP doesn't support automatic type convertors so we explicitly allow a
  28. // QColor to be used whenever a QPen is expected.
  29. if (sipIsErr == NULL)
  30. return (sipCanConvertToType(sipPy, sipType_QPen, SIP_NO_CONVERTORS) ||
  31. sipCanConvertToType(sipPy, sipType_QColor, 0));
  32. if (sipCanConvertToType(sipPy, sipType_QPen, SIP_NO_CONVERTORS))
  33. {
  34. *sipCppPtr = reinterpret_cast<QPen *>(sipConvertToType(sipPy, sipType_QPen, sipTransferObj, SIP_NO_CONVERTORS, 0, sipIsErr));
  35. return 0;
  36. }
  37. int state;
  38. QColor *c = reinterpret_cast<QColor *>(sipConvertToType(sipPy, sipType_QColor, 0, 0, &state, sipIsErr));
  39. if (*sipIsErr)
  40. {
  41. sipReleaseType(c, sipType_QColor, state);
  42. return 0;
  43. }
  44. *sipCppPtr = new QPen(*c);
  45. sipReleaseType(c, sipType_QColor, state);
  46. return sipGetState(sipTransferObj);
  47. %End
  48. public:
  49. QPen();
  50. QPen(Qt::PenStyle);
  51. QPen(const QBrush &brush, qreal width, Qt::PenStyle style = Qt::SolidLine, Qt::PenCapStyle cap = Qt::SquareCap, Qt::PenJoinStyle join = Qt::BevelJoin);
  52. QPen(const QPen &pen);
  53. QPen(const QVariant &variant /GetWrapper/) /NoDerived/;
  54. %MethodCode
  55. if (a0->canConvert<QPen>())
  56. sipCpp = new QPen(a0->value<QPen>());
  57. else
  58. sipError = sipBadCallableArg(0, a0Wrapper);
  59. %End
  60. ~QPen();
  61. Qt::PenStyle style() const;
  62. void setStyle(Qt::PenStyle);
  63. qreal widthF() const;
  64. void setWidthF(qreal width);
  65. int width() const;
  66. void setWidth(int width);
  67. QColor color() const;
  68. void setColor(const QColor &color);
  69. QBrush brush() const;
  70. void setBrush(const QBrush &brush);
  71. bool isSolid() const;
  72. Qt::PenCapStyle capStyle() const;
  73. void setCapStyle(Qt::PenCapStyle pcs);
  74. Qt::PenJoinStyle joinStyle() const;
  75. void setJoinStyle(Qt::PenJoinStyle pcs);
  76. QList<qreal> dashPattern() const;
  77. void setDashPattern(const QList<qreal> &pattern);
  78. qreal miterLimit() const;
  79. void setMiterLimit(qreal limit);
  80. bool operator==(const QPen &p) const;
  81. bool operator!=(const QPen &p) const;
  82. qreal dashOffset() const;
  83. void setDashOffset(qreal doffset);
  84. bool isCosmetic() const;
  85. void setCosmetic(bool cosmetic);
  86. void swap(QPen &other /Constrained/);
  87. };
  88. QDataStream &operator<<(QDataStream &, const QPen &) /ReleaseGIL/;
  89. QDataStream &operator>>(QDataStream &, QPen & /Constrained/) /ReleaseGIL/;
  90. %If (Qt_6_9_0 -)
  91. bool operator!=(const QPen &lhs, const Qt::PenStyle &rhs);
  92. %End
  93. %If (Qt_6_9_0 -)
  94. bool operator!=(const QPen &lhs, const QColor &rhs);
  95. %End
  96. %If (Qt_6_9_0 -)
  97. bool operator!=(const QColor &lhs, const QPen &rhs);
  98. %End
  99. %If (Qt_6_9_0 -)
  100. bool operator==(const QPen &lhs, const Qt::PenStyle &rhs);
  101. %End
  102. %If (Qt_6_9_0 -)
  103. bool operator==(const QPen &lhs, const QColor &rhs);
  104. %End
  105. %If (Qt_6_9_0 -)
  106. bool operator==(const QColor &lhs, const QPen &rhs);
  107. %End