qobject.sip 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650
  1. // qobject.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. typedef QList<QObject *> QObjectList;
  22. class QObject /Supertype=PyQt6.sip.wrapper/
  23. {
  24. %TypeHeaderCode
  25. #include <qobject.h>
  26. %End
  27. %TypeCode
  28. // This is needed by the tr() handwritten implementation.
  29. #include <qcoreapplication.h>
  30. // These are the helper functions for QObject::findChild() and
  31. // QObject::findChildren.
  32. // Wrap the given type in a 1-tuple.
  33. static PyObject *qtcore_type_to_tuple(PyObject *type)
  34. {
  35. PyObject *tuple = PyTuple_New(1);
  36. if (tuple)
  37. {
  38. Py_INCREF(type);
  39. PyTuple_SetItem(tuple, 0, type);
  40. }
  41. return tuple;
  42. }
  43. // Check all elements of a given tuple are type objects and return a new
  44. // reference to the tuple if so.
  45. static PyObject *qtcore_check_tuple_types(PyObject *types)
  46. {
  47. for (Py_ssize_t i = 0; i < PyTuple_Size(types); ++i)
  48. if (!PyObject_TypeCheck(PyTuple_GetItem(types, i), &PyType_Type))
  49. {
  50. PyErr_SetString(PyExc_TypeError,
  51. "all elements of the types argument must be type objects");
  52. return 0;
  53. }
  54. Py_INCREF(types);
  55. return types;
  56. }
  57. // Do the main work of finding a child.
  58. static PyObject *qtcore_do_find_child(const QObject *parent, PyObject *types, const QString &name, Qt::FindChildOptions options)
  59. {
  60. const QObjectList &children = parent->children();
  61. int i;
  62. for (i = 0; i < children.size(); ++i)
  63. {
  64. QObject *obj = children.at(i);
  65. PyObject *pyo = sipConvertFromType(obj, sipType_QObject, 0);
  66. if (!pyo)
  67. return 0;
  68. // Allow for proxies.
  69. QObject *resolved = reinterpret_cast<QObject *>(sipGetAddress((sipSimpleWrapper *)pyo));
  70. if (name.isNull() || resolved->objectName() == name)
  71. for (Py_ssize_t t = 0; t < PyTuple_Size(types); ++t)
  72. if (PyType_IsSubtype(Py_TYPE(pyo), (PyTypeObject *)PyTuple_GetItem(types, t)))
  73. return pyo;
  74. Py_DECREF(pyo);
  75. }
  76. if (options == Qt::FindChildrenRecursively)
  77. for (i = 0; i < children.size(); ++i)
  78. {
  79. PyObject *pyo = qtcore_do_find_child(children.at(i), types, name, options);
  80. if (pyo != Py_None)
  81. return pyo;
  82. Py_DECREF(pyo);
  83. }
  84. Py_INCREF(Py_None);
  85. return Py_None;
  86. }
  87. // Find a child that is one of a number of types and with an optional name.
  88. static PyObject *qtcore_FindChild(const QObject *parent, PyObject *types, const QString &name, Qt::FindChildOptions options)
  89. {
  90. // Check that the types checking was successful.
  91. if (!types)
  92. return 0;
  93. PyObject *child = qtcore_do_find_child(parent, types, name, options);
  94. Py_DECREF(types);
  95. return child;
  96. }
  97. // Do the main work of finding the children with a string name.
  98. static bool qtcore_do_find_children(const QObject *parent, PyObject *types, const QString &name, Qt::FindChildOptions options, PyObject *list)
  99. {
  100. const QObjectList &children = parent->children();
  101. int i;
  102. for (i = 0; i < children.size(); ++i)
  103. {
  104. QObject *obj = children.at(i);
  105. PyObject *pyo = sipConvertFromType(obj, sipType_QObject, 0);
  106. if (!pyo)
  107. return false;
  108. // Allow for proxies.
  109. QObject *resolved = reinterpret_cast<QObject *>(sipGetAddress((sipSimpleWrapper *)pyo));
  110. if (name.isNull() || resolved->objectName() == name)
  111. for (Py_ssize_t t = 0; t < PyTuple_Size(types); ++t)
  112. if (PyType_IsSubtype(Py_TYPE(pyo), (PyTypeObject *)PyTuple_GetItem(types, t)))
  113. if (PyList_Append(list, pyo) < 0)
  114. {
  115. Py_DECREF(pyo);
  116. return false;
  117. }
  118. Py_DECREF(pyo);
  119. if (options == Qt::FindChildrenRecursively)
  120. {
  121. bool ok = qtcore_do_find_children(obj, types, name, options, list);
  122. if (!ok)
  123. return false;
  124. }
  125. }
  126. return true;
  127. }
  128. // Find a child that is one of a number of types and with an optional string
  129. // name.
  130. static PyObject *qtcore_FindChildren(const QObject *parent, PyObject *types, const QString &name, Qt::FindChildOptions options)
  131. {
  132. // Check that the types checking was successful.
  133. if (!types)
  134. return 0;
  135. PyObject *list = PyList_New(0);
  136. if (list)
  137. if (!qtcore_do_find_children(parent, types, name, options, list))
  138. Py_DECREF(list);
  139. Py_DECREF(types);
  140. return list;
  141. }
  142. // Do the main work of finding the children with a QRegularExpression name.
  143. static bool qtcore_do_find_children(const QObject *parent, PyObject *types, const QRegularExpression &re, Qt::FindChildOptions options, PyObject *list)
  144. {
  145. const QObjectList &children = parent->children();
  146. int i;
  147. for (i = 0; i < children.size(); ++i)
  148. {
  149. QObject *obj = children.at(i);
  150. PyObject *pyo = sipConvertFromType(obj, sipType_QObject, 0);
  151. if (!pyo)
  152. return false;
  153. QRegularExpressionMatch m = re.match(obj->objectName());
  154. if (m.hasMatch())
  155. for (Py_ssize_t t = 0; t < PyTuple_Size(types); ++t)
  156. if (PyType_IsSubtype(Py_TYPE(pyo), (PyTypeObject *)PyTuple_GetItem(types, t)))
  157. if (PyList_Append(list, pyo) < 0)
  158. {
  159. Py_DECREF(pyo);
  160. return false;
  161. }
  162. Py_DECREF(pyo);
  163. if (options == Qt::FindChildrenRecursively)
  164. {
  165. bool ok = qtcore_do_find_children(obj, types, re, options, list);
  166. if (!ok)
  167. return false;
  168. }
  169. }
  170. return true;
  171. }
  172. // Find a child that is one of a number of types and with an optional
  173. // QRegularExpression name.
  174. static PyObject *qtcore_FindChildren(const QObject *parent, PyObject *types, const QRegularExpression &re, Qt::FindChildOptions options)
  175. {
  176. // Check that the types checking was successful.
  177. if (!types)
  178. return 0;
  179. PyObject *list = PyList_New(0);
  180. if (list)
  181. if (!qtcore_do_find_children(parent, types, re, options, list))
  182. Py_DECREF(list);
  183. Py_DECREF(types);
  184. return list;
  185. }
  186. %End
  187. %FinalisationCode
  188. return qpycore_qobject_finalisation(sipSelf, sipCpp, sipKwds, sipUnused);
  189. %End
  190. %ConvertToSubClassCode
  191. static struct class_graph {
  192. const char *name;
  193. sipTypeDef **type;
  194. int yes, no;
  195. } graph[] = {
  196. {sipName_QAbstractAnimation, &sipType_QAbstractAnimation, 24, 1},
  197. {sipName_QAbstractEventDispatcher, &sipType_QAbstractEventDispatcher, -1, 2},
  198. {sipName_QAbstractItemModel, &sipType_QAbstractItemModel, 30, 3},
  199. {sipName_QIODevice, &sipType_QIODevice, 39, 4},
  200. {sipName_QCoreApplication, &sipType_QCoreApplication, -1, 5},
  201. {sipName_QEventLoop, &sipType_QEventLoop, -1, 6},
  202. {sipName_QFileSelector, &sipType_QFileSelector, -1, 7},
  203. {sipName_QFileSystemWatcher, &sipType_QFileSystemWatcher, -1, 8},
  204. {sipName_QItemSelectionModel, &sipType_QItemSelectionModel, -1, 9},
  205. {sipName_QLibrary, &sipType_QLibrary, -1, 10},
  206. {sipName_QMimeData, &sipType_QMimeData, -1, 11},
  207. {sipName_QObjectCleanupHandler, &sipType_QObjectCleanupHandler, -1, 12},
  208. {sipName_QPluginLoader, &sipType_QPluginLoader, -1, 13},
  209. #if QT_VERSION >= 0x060a00
  210. {sipName_QPyAbstractRange, &sipType_QPyAbstractRange, 45, 14},
  211. #else
  212. {0, 0, 45, 14},
  213. #endif
  214. {sipName_QSettings, &sipType_QSettings, -1, 15},
  215. {sipName_QSharedMemory, &sipType_QSharedMemory, -1, 16},
  216. {sipName_QSignalMapper, &sipType_QSignalMapper, -1, 17},
  217. {sipName_QSocketNotifier, &sipType_QSocketNotifier, -1, 18},
  218. {sipName_QThread, &sipType_QThread, -1, 19},
  219. {sipName_QThreadPool, &sipType_QThreadPool, -1, 20},
  220. {sipName_QTimeLine, &sipType_QTimeLine, -1, 21},
  221. {sipName_QTimer, &sipType_QTimer, -1, 22},
  222. {sipName_QTranslator, &sipType_QTranslator, -1, 23},
  223. #if defined(Q_OS_WIN)
  224. {sipName_QWinEventNotifier, &sipType_QWinEventNotifier, -1, -1},
  225. #else
  226. {0, 0, -1, -1},
  227. #endif
  228. {sipName_QAnimationGroup, &sipType_QAnimationGroup, 27, 25},
  229. {sipName_QPauseAnimation, &sipType_QPauseAnimation, -1, 26},
  230. {sipName_QVariantAnimation, &sipType_QVariantAnimation, 29, -1},
  231. {sipName_QParallelAnimationGroup, &sipType_QParallelAnimationGroup, -1, 28},
  232. {sipName_QSequentialAnimationGroup, &sipType_QSequentialAnimationGroup, -1, -1},
  233. {sipName_QPropertyAnimation, &sipType_QPropertyAnimation, -1, -1},
  234. {sipName_QAbstractListModel, &sipType_QAbstractListModel, 35, 31},
  235. {sipName_QAbstractProxyModel, &sipType_QAbstractProxyModel, 36, 32},
  236. {sipName_QAbstractTableModel, &sipType_QAbstractTableModel, -1, 33},
  237. {sipName_QConcatenateTablesProxyModel, &sipType_QConcatenateTablesProxyModel, -1, 34},
  238. #if QT_VERSION >= 0x060a00
  239. {sipName_QRangeModel, &sipType_QRangeModel, -1, -1},
  240. #else
  241. {0, 0, -1, -1},
  242. #endif
  243. {sipName_QStringListModel, &sipType_QStringListModel, -1, -1},
  244. {sipName_QIdentityProxyModel, &sipType_QIdentityProxyModel, -1, 37},
  245. {sipName_QSortFilterProxyModel, &sipType_QSortFilterProxyModel, -1, 38},
  246. {sipName_QTransposeProxyModel, &sipType_QTransposeProxyModel, -1, -1},
  247. {sipName_QBuffer, &sipType_QBuffer, -1, 40},
  248. {sipName_QFileDevice, &sipType_QFileDevice, 42, 41},
  249. #if !defined(QT_NO_PROCESS)
  250. {sipName_QProcess, &sipType_QProcess, -1, -1},
  251. #else
  252. {0, 0, -1, -1},
  253. #endif
  254. {sipName_QFile, &sipType_QFile, 44, 43},
  255. {sipName_QSaveFile, &sipType_QSaveFile, -1, -1},
  256. {sipName_QTemporaryFile, &sipType_QTemporaryFile, -1, -1},
  257. #if QT_VERSION >= 0x060a00
  258. {sipName_QPySequenceRange, &sipType_QPySequenceRange, -1, 46},
  259. #else
  260. {0, 0, -1, 46},
  261. #endif
  262. #if QT_VERSION >= 0x060a00
  263. {sipName_QPyTableRange, &sipType_QPyTableRange, -1, -1},
  264. #else
  265. {0, 0, -1, -1},
  266. #endif
  267. };
  268. int i = 0;
  269. sipType = NULL;
  270. do
  271. {
  272. struct class_graph *cg = &graph[i];
  273. if (cg->name != NULL && sipCpp->inherits(cg->name))
  274. {
  275. sipType = *cg->type;
  276. i = cg->yes;
  277. }
  278. else
  279. i = cg->no;
  280. }
  281. while (i >= 0);
  282. %End
  283. %GCTraverseCode
  284. // Traverse any saved slots we might be connected to.
  285. sipRes = qpycore_visitSlotProxies(sipCpp, sipVisit, sipArg);
  286. %End
  287. %GCClearCode
  288. // Clear any saved slots we might be connected to.
  289. sipRes = qpycore_clearSlotProxies(sipCpp);
  290. %End
  291. public:
  292. static const QMetaObject staticMetaObject {
  293. %GetCode
  294. sipPy = qpycore_qobject_staticmetaobject(sipPyType);
  295. %End
  296. };
  297. const QMetaObject *metaObject() const;
  298. explicit QObject(QObject *parent /TransferThis/ = 0);
  299. virtual ~QObject();
  300. void pyqtConfigure(SIP_PYOBJECT) /NoArgParser/;
  301. %Docstring
  302. QObject.pyqtConfigure(...)
  303. Each keyword argument is either the name of a Qt property or a Qt signal.
  304. For properties the property is set to the given value which should be of an
  305. appropriate type.
  306. For signals the signal is connected to the given value which should be a
  307. callable.
  308. %End
  309. %MethodCode
  310. return qpycore_pyqtconfigure(sipSelf, sipArgs, sipKwds);
  311. %End
  312. SIP_PYOBJECT __getattr__(const char *name /Encoding="UTF-8"/) const /NoTypeHint/;
  313. %MethodCode
  314. sipRes = qpycore_qobject_getattr(sipCpp, sipSelf, a0);
  315. %End
  316. virtual bool event(QEvent *);
  317. virtual bool eventFilter(QObject *, QEvent *);
  318. static QString tr(const char *sourceText /Encoding="UTF-8"/, const char *disambiguation = 0, int n = -1);
  319. %MethodCode
  320. sipRes = new QString(QCoreApplication::translate(sipPyTypeName((PyTypeObject *)sipSelf), a0, a1, a2));
  321. %End
  322. SIP_PYOBJECT findChild(SIP_PYTYPE type /TypeHint="Type[QObjectT]"/, const QString &name = QString(), Qt::FindChildOptions options = Qt::FindChildrenRecursively) const /TypeHint="QObjectT"/;
  323. %MethodCode
  324. sipRes = qtcore_FindChild(sipCpp, qtcore_type_to_tuple(a0), *a1, *a2);
  325. if (!sipRes)
  326. sipIsErr = 1;
  327. %End
  328. SIP_PYOBJECT findChild(SIP_PYTUPLE types /TypeHint="Tuple[Type[QObjectT], ...]", TypeHintValue="()"/, const QString &name = QString(), Qt::FindChildOptions options = Qt::FindChildrenRecursively) const /TypeHint="QObjectT"/;
  329. %MethodCode
  330. sipRes = qtcore_FindChild(sipCpp, qtcore_check_tuple_types(a0), *a1, *a2);
  331. if (!sipRes)
  332. sipIsErr = 1;
  333. %End
  334. SIP_PYLIST findChildren(SIP_PYTYPE type /TypeHint="Type[QObjectT]"/, const QString &name = QString(), Qt::FindChildOptions options = Qt::FindChildrenRecursively) const /TypeHint="List[QObjectT]"/;
  335. %MethodCode
  336. sipRes = qtcore_FindChildren(sipCpp, qtcore_type_to_tuple(a0), *a1, *a2);
  337. if (!sipRes)
  338. sipIsErr = 1;
  339. %End
  340. SIP_PYLIST findChildren(SIP_PYTUPLE types /TypeHint="Tuple[Type[QObjectT], ...]", TypeHintValue="()"/, const QString &name = QString(), Qt::FindChildOptions options = Qt::FindChildrenRecursively) const /TypeHint="List[QObjectT]"/;
  341. %MethodCode
  342. sipRes = qtcore_FindChildren(sipCpp, qtcore_check_tuple_types(a0), *a1, *a2);
  343. if (!sipRes)
  344. sipIsErr = 1;
  345. %End
  346. SIP_PYLIST findChildren(SIP_PYTYPE type /TypeHint="Type[QObjectT]"/, const QRegularExpression &re, Qt::FindChildOptions options = Qt::FindChildrenRecursively) const /TypeHint="List[QObjectT]"/;
  347. %MethodCode
  348. sipRes = qtcore_FindChildren(sipCpp, qtcore_type_to_tuple(a0), *a1, *a2);
  349. if (!sipRes)
  350. sipIsErr = 1;
  351. %End
  352. SIP_PYLIST findChildren(SIP_PYTUPLE types /TypeHint="Tuple[Type[QObjectT], ...]", TypeHintValue="()"/, const QRegularExpression &re, Qt::FindChildOptions options = Qt::FindChildrenRecursively) const /TypeHint="List[QObjectT]"/;
  353. %MethodCode
  354. sipRes = qtcore_FindChildren(sipCpp, qtcore_check_tuple_types(a0), *a1, *a2);
  355. if (!sipRes)
  356. sipIsErr = 1;
  357. %End
  358. QString objectName() const;
  359. %If (Qt_6_4_0 -)
  360. void setObjectName(QAnyStringView name);
  361. %End
  362. %If (- Qt_6_4_0)
  363. void setObjectName(const QString &name);
  364. %End
  365. bool isWidgetType() const;
  366. bool isWindowType() const;
  367. bool signalsBlocked() const;
  368. bool blockSignals(bool b);
  369. QThread *thread() const;
  370. void moveToThread(QThread *thread);
  371. int startTimer(int interval, Qt::TimerType timerType = Qt::CoarseTimer);
  372. void killTimer(int id);
  373. const QObjectList &children() const;
  374. void setParent(QObject * /TransferThis/);
  375. void installEventFilter(QObject *);
  376. void removeEventFilter(QObject *);
  377. void dumpObjectInfo() const;
  378. void dumpObjectTree() const;
  379. QList<QByteArray> dynamicPropertyNames() const;
  380. bool setProperty(const char *name, const QVariant &value);
  381. QVariant property(const char *name) const;
  382. signals:
  383. void destroyed(QObject *object = 0);
  384. void objectNameChanged(const QString &objectName);
  385. public:
  386. QObject *parent() const;
  387. bool inherits(const char *classname) const;
  388. public slots:
  389. void deleteLater() /TransferThis/;
  390. protected:
  391. QObject *sender() const /ReleaseGIL/;
  392. %MethodCode
  393. // sender() must be called without the GIL to avoid possible deadlocks between
  394. // the GIL and Qt's internal thread data mutex.
  395. Py_BEGIN_ALLOW_THREADS
  396. #if defined(SIP_PROTECTED_IS_PUBLIC)
  397. sipRes = sipCpp->sender();
  398. #else
  399. sipRes = sipCpp->sipProtect_sender();
  400. #endif
  401. Py_END_ALLOW_THREADS
  402. if (!sipRes)
  403. {
  404. typedef QObject *(*qtcore_qobject_sender_t)();
  405. static qtcore_qobject_sender_t qtcore_qobject_sender = 0;
  406. if (!qtcore_qobject_sender)
  407. {
  408. qtcore_qobject_sender = (qtcore_qobject_sender_t)sipImportSymbol("qtcore_qobject_sender");
  409. Q_ASSERT(qtcore_qobject_sender);
  410. }
  411. sipRes = qtcore_qobject_sender();
  412. }
  413. %End
  414. int receivers(SIP_PYOBJECT signal /TypeHint="PYQT_SIGNAL"/) const [int (const char *signal)];
  415. %MethodCode
  416. // We need to handle the signal object. Import the helper if it hasn't already
  417. // been done.
  418. typedef sipErrorState (*pyqt6_get_signal_signature_t)(PyObject *, const QObject *, const QByteArray &);
  419. static pyqt6_get_signal_signature_t pyqt6_get_signal_signature = 0;
  420. if (!pyqt6_get_signal_signature)
  421. {
  422. pyqt6_get_signal_signature = (pyqt6_get_signal_signature_t)sipImportSymbol("pyqt6_get_signal_signature");
  423. Q_ASSERT(pyqt6_get_signal_signature);
  424. }
  425. QByteArray signal_signature;
  426. #if defined(SIP_PROTECTED_IS_PUBLIC)
  427. if ((sipError = pyqt6_get_signal_signature(a0, sipCpp, signal_signature)) == sipErrorNone)
  428. {
  429. sipRes = sipCpp->receivers(signal_signature.constData());
  430. }
  431. #else
  432. if ((sipError = pyqt6_get_signal_signature(a0, static_cast<const QObject *>(sipCpp), signal_signature)) == sipErrorNone)
  433. {
  434. sipRes = sipCpp->sipProtect_receivers(signal_signature.constData());
  435. }
  436. #endif
  437. else if (sipError == sipErrorContinue)
  438. {
  439. sipError = sipBadCallableArg(0, a0);
  440. }
  441. %End
  442. virtual void timerEvent(QTimerEvent *);
  443. virtual void childEvent(QChildEvent *);
  444. virtual void customEvent(QEvent *);
  445. virtual void connectNotify(const QMetaMethod &signal);
  446. virtual void disconnectNotify(const QMetaMethod &signal);
  447. int senderSignalIndex() const;
  448. bool isSignalConnected(const QMetaMethod &signal) const;
  449. public:
  450. static bool disconnect(const QMetaObject::Connection &);
  451. SIP_PYOBJECT disconnect() const /TypeHint=""/;
  452. %MethodCode
  453. sipRes = qpycore_qobject_disconnect(sipCpp);
  454. %End
  455. %If (Qt_6_4_0 -)
  456. bool isQuickItemType() const;
  457. %End
  458. %If (Qt_6_11_0 -)
  459. bool isQmlExposed() const;
  460. %End
  461. private:
  462. QObject(const QObject &);
  463. };
  464. SIP_PYOBJECT pyqtClassInfo(const char *, const char *) /NoArgParser, TypeHint=""/;
  465. %MethodCode
  466. return qpycore_pyqtClassInfo(sipArgs, sipKwds);
  467. %End
  468. SIP_PYOBJECT pyqtEnum(SIP_PYENUM = 0) /TypeHint=""/;
  469. %MethodCode
  470. sipRes = qpycore_pyqtEnum(a0);
  471. %End
  472. SIP_PYOBJECT pyqtSlot(... types, const char *name = 0, const char *result = 0) /NoArgParser, NoTypeHint/;
  473. %Docstring
  474. @pyqtSlot(*types, name: typing.Optional[str], result: typing.Optional[str])
  475. This is a decorator applied to Python methods of a QObject that marks them
  476. as Qt slots.
  477. The non-keyword arguments are the types of the slot arguments and each may
  478. be a Python type object or a string specifying a C++ type.
  479. name is the name of the slot and defaults to the name of the method.
  480. result is type of the value returned by the slot.
  481. %End
  482. %MethodCode
  483. return qpycore_pyqtslot(sipArgs, sipKwds);
  484. %End
  485. SIP_PYOBJECT QT_TR_NOOP(SIP_PYOBJECT /TypeHint="str"/) /TypeHint="str"/;
  486. %MethodCode
  487. Py_INCREF(a0);
  488. sipRes = a0;
  489. %End
  490. SIP_PYOBJECT QT_TRANSLATE_NOOP(SIP_PYOBJECT /TypeHint="str"/, SIP_PYOBJECT /TypeHint="str"/) /TypeHint="str"/;
  491. %MethodCode
  492. Py_INCREF(a1);
  493. sipRes = a1;
  494. %End
  495. class QSignalBlocker
  496. {
  497. %TypeHeaderCode
  498. #include <qobject.h>
  499. %End
  500. public:
  501. explicit QSignalBlocker(QObject *o);
  502. ~QSignalBlocker();
  503. %If (Qt_6_7_0 -)
  504. void dismiss();
  505. %End
  506. void reblock();
  507. void unblock();
  508. SIP_PYOBJECT __enter__();
  509. %MethodCode
  510. // Just return a reference to self.
  511. sipRes = sipSelf;
  512. Py_INCREF(sipRes);
  513. %End
  514. void __exit__(SIP_PYOBJECT type, SIP_PYOBJECT value, SIP_PYOBJECT traceback);
  515. %MethodCode
  516. sipCpp->unblock();
  517. %End
  518. private:
  519. QSignalBlocker(const QSignalBlocker &);
  520. };
  521. %ModuleHeaderCode
  522. #include "qpycore_api.h"
  523. %End
  524. %InitialisationCode
  525. qpycore_init();
  526. %End
  527. %PostInitialisationCode
  528. qpycore_post_init(sipModuleDict);
  529. %End