qmetaobject.sip 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. // qmetaobject.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. class QMetaMethod
  22. {
  23. %TypeHeaderCode
  24. #include <qmetaobject.h>
  25. %End
  26. %TypeCode
  27. // Raise an exception when QMetaMethod::invoke() returns false.
  28. static void qtcore_invoke_exception()
  29. {
  30. PyErr_SetString(PyExc_RuntimeError, "QMetaMethod.invoke() call failed");
  31. }
  32. %End
  33. public:
  34. QMetaMethod();
  35. const char *typeName() const;
  36. QList<QByteArray> parameterTypes() const;
  37. QList<QByteArray> parameterNames() const;
  38. const char *tag() const;
  39. enum Access
  40. {
  41. Private,
  42. Protected,
  43. Public,
  44. };
  45. QMetaMethod::Access access() const;
  46. enum MethodType
  47. {
  48. Method,
  49. Signal,
  50. Slot,
  51. Constructor,
  52. };
  53. QMetaMethod::MethodType methodType() const;
  54. SIP_PYOBJECT invoke(QObject *object, QGenericArgument value0 = QGenericArgument(nullptr), QGenericArgument value1 = QGenericArgument(), QGenericArgument value2 = QGenericArgument(), QGenericArgument value3 = QGenericArgument(), QGenericArgument value4 = QGenericArgument(), QGenericArgument value5 = QGenericArgument(), QGenericArgument value6 = QGenericArgument(), QGenericArgument value7 = QGenericArgument(), QGenericArgument value8 = QGenericArgument(), QGenericArgument value9 = QGenericArgument()) const;
  55. %MethodCode
  56. // Raise an exception if the call failed.
  57. bool ok;
  58. Py_BEGIN_ALLOW_THREADS
  59. ok = sipCpp->invoke(a0, *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8, *a9, *a10);
  60. Py_END_ALLOW_THREADS
  61. if (ok)
  62. {
  63. Py_INCREF(Py_None);
  64. sipRes = Py_None;
  65. }
  66. else
  67. {
  68. qtcore_invoke_exception();
  69. }
  70. %End
  71. SIP_PYOBJECT invoke(QObject *object, Qt::ConnectionType connectionType, QGenericArgument value0 = QGenericArgument(nullptr), QGenericArgument value1 = QGenericArgument(), QGenericArgument value2 = QGenericArgument(), QGenericArgument value3 = QGenericArgument(), QGenericArgument value4 = QGenericArgument(), QGenericArgument value5 = QGenericArgument(), QGenericArgument value6 = QGenericArgument(), QGenericArgument value7 = QGenericArgument(), QGenericArgument value8 = QGenericArgument(), QGenericArgument value9 = QGenericArgument()) const;
  72. %MethodCode
  73. // Raise an exception if the call failed.
  74. bool ok;
  75. Py_BEGIN_ALLOW_THREADS
  76. ok = sipCpp->invoke(a0, a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8, *a9, *a10, *a11);
  77. Py_END_ALLOW_THREADS
  78. if (ok)
  79. {
  80. Py_INCREF(Py_None);
  81. sipRes = Py_None;
  82. }
  83. else
  84. {
  85. qtcore_invoke_exception();
  86. }
  87. %End
  88. SIP_PYOBJECT invoke(QObject *object, QGenericReturnArgument returnValue /GetWrapper/, QGenericArgument value0 = QGenericArgument(nullptr), QGenericArgument value1 = QGenericArgument(), QGenericArgument value2 = QGenericArgument(), QGenericArgument value3 = QGenericArgument(), QGenericArgument value4 = QGenericArgument(), QGenericArgument value5 = QGenericArgument(), QGenericArgument value6 = QGenericArgument(), QGenericArgument value7 = QGenericArgument(), QGenericArgument value8 = QGenericArgument(), QGenericArgument value9 = QGenericArgument()) const;
  89. %MethodCode
  90. // Raise an exception if the call failed.
  91. bool ok;
  92. Py_BEGIN_ALLOW_THREADS
  93. ok = sipCpp->invoke(a0, *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8, *a9, *a10,
  94. *a11);
  95. Py_END_ALLOW_THREADS
  96. if (ok)
  97. sipRes = qpycore_ReturnValue(a1Wrapper);
  98. else
  99. qtcore_invoke_exception();
  100. %End
  101. SIP_PYOBJECT invoke(QObject *object, Qt::ConnectionType connectionType, QGenericReturnArgument returnValue /GetWrapper/, QGenericArgument value0 = QGenericArgument(nullptr), QGenericArgument value1 = QGenericArgument(), QGenericArgument value2 = QGenericArgument(), QGenericArgument value3 = QGenericArgument(), QGenericArgument value4 = QGenericArgument(), QGenericArgument value5 = QGenericArgument(), QGenericArgument value6 = QGenericArgument(), QGenericArgument value7 = QGenericArgument(), QGenericArgument value8 = QGenericArgument(), QGenericArgument value9 = QGenericArgument()) const;
  102. %MethodCode
  103. // Raise an exception if the call failed.
  104. bool ok;
  105. Py_BEGIN_ALLOW_THREADS
  106. ok = sipCpp->invoke(a0, a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8, *a9, *a10, *a11,
  107. *a12);
  108. Py_END_ALLOW_THREADS
  109. if (ok)
  110. sipRes = qpycore_ReturnValue(a2Wrapper);
  111. else
  112. qtcore_invoke_exception();
  113. %End
  114. int methodIndex() const;
  115. int revision() const;
  116. bool isValid() const;
  117. QByteArray methodSignature() const;
  118. QByteArray name() const;
  119. int returnType() const;
  120. int parameterCount() const;
  121. int parameterType(int index) const;
  122. QMetaType returnMetaType() const;
  123. QMetaType parameterMetaType(int index) const;
  124. QByteArray parameterTypeName(int index) const;
  125. int relativeMethodIndex() const;
  126. %If (Qt_6_2_0 -)
  127. bool isConst() const;
  128. %End
  129. };
  130. class QMetaEnum
  131. {
  132. %TypeHeaderCode
  133. #include <qmetaobject.h>
  134. %End
  135. public:
  136. QMetaEnum();
  137. const char *name() const;
  138. bool isFlag() const;
  139. int keyCount() const;
  140. const char *key(int index) const;
  141. int value(int index) const;
  142. const char *scope() const;
  143. int keyToValue(const char *key, bool *ok = 0) const;
  144. %If (Qt_6_9_0 -)
  145. const char *valueToKey(quint64 value) const;
  146. %End
  147. %If (- Qt_6_9_0)
  148. const char *valueToKey(int value) const;
  149. %End
  150. int keysToValue(const char *keys, bool *ok = 0) const;
  151. %If (Qt_6_9_0 -)
  152. QByteArray valueToKeys(quint64 value) const;
  153. %End
  154. %If (- Qt_6_9_0)
  155. QByteArray valueToKeys(int value) const;
  156. %End
  157. bool isValid() const;
  158. bool isScoped() const;
  159. const char *enumName() const;
  160. %If (Qt_6_6_0 -)
  161. QMetaType metaType() const;
  162. %End
  163. %If (Qt_6_9_0 -)
  164. bool is64Bit() const;
  165. %End
  166. };
  167. class QMetaProperty
  168. {
  169. %TypeHeaderCode
  170. #include <qmetaobject.h>
  171. %End
  172. public:
  173. QMetaProperty();
  174. const char *name() const;
  175. const char *typeName() const;
  176. bool isReadable() const;
  177. bool isWritable() const;
  178. bool isDesignable() const;
  179. bool isScriptable() const;
  180. bool isStored() const;
  181. bool isFlagType() const;
  182. bool isEnumType() const;
  183. QMetaEnum enumerator() const;
  184. SIP_PYOBJECT read(const QObject *obj) const /TypeHint="Any"/;
  185. %MethodCode
  186. // Make use of the QMetaProperty to provide the extra information to correctly
  187. // handle enums.
  188. sipRes = qpycore_PyObject_FromQVariant(*sipCpp, sipCpp->read(a0));
  189. %End
  190. bool write(QObject *obj, const QVariant &value) const;
  191. %MethodCode
  192. // If it looks like we are trying to write an int to an enum then we are
  193. // probably trying to write to an unregistered enum. Converting the int to the
  194. // name of the corresponding key should work (although this isn't a documented
  195. // feature).
  196. QMetaEnum me = sipCpp->enumerator();
  197. if (me.isValid() && a1->typeId() == QMetaType::Int)
  198. {
  199. QString key;
  200. if (me.isFlag())
  201. {
  202. key = QString(me.valueToKeys(a1->toInt()));
  203. }
  204. else
  205. {
  206. const char *key_s = me.valueToKey(a1->toInt());
  207. if (key_s)
  208. {
  209. key = QString(key_s);
  210. }
  211. else
  212. {
  213. PyErr_Format(PyExc_ValueError, "%S is not a valid enum member", a1);
  214. sipIsErr = 1;
  215. }
  216. }
  217. if (!sipIsErr)
  218. *const_cast<QVariant *>(a1) = QVariant(key);
  219. }
  220. if (!sipIsErr)
  221. sipRes = sipCpp->write(a0, *a1);
  222. %End
  223. bool reset(QObject *obj) const;
  224. bool hasStdCppSet() const;
  225. bool isValid() const;
  226. bool isResettable() const;
  227. bool isUser() const;
  228. int userType() const;
  229. bool hasNotifySignal() const;
  230. QMetaMethod notifySignal() const;
  231. int notifySignalIndex() const;
  232. int propertyIndex() const;
  233. bool isConstant() const;
  234. bool isFinal() const;
  235. int revision() const;
  236. int relativePropertyIndex() const;
  237. bool isRequired() const;
  238. QMetaType metaType() const;
  239. bool isBindable() const;
  240. int typeId() const;
  241. %If (Qt_6_11_0 -)
  242. bool isVirtual() const;
  243. %End
  244. %If (Qt_6_11_0 -)
  245. bool isOverride() const;
  246. %End
  247. };
  248. class QMetaClassInfo
  249. {
  250. %TypeHeaderCode
  251. #include <qmetaobject.h>
  252. %End
  253. public:
  254. QMetaClassInfo();
  255. const char *name() const;
  256. const char *value() const;
  257. };
  258. bool operator==(const QMetaMethod &m1, const QMetaMethod &m2);
  259. bool operator!=(const QMetaMethod &m1, const QMetaMethod &m2);