1 // This defines the interfaces for the pyqtSignal type. 2 // 3 // Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com> 4 // 5 // This file is part of PyQt5. 6 // 7 // This file may be used under the terms of the GNU General Public License 8 // version 3.0 as published by the Free Software Foundation and appearing in 9 // the file LICENSE included in the packaging of this file. Please review the 10 // following information to ensure the GNU General Public License version 3.0 11 // requirements will be met: http://www.gnu.org/copyleft/gpl.html. 12 // 13 // If you do not wish to use this file under the terms of the GPL version 3.0 14 // then you may purchase a commercial license. For more information contact 15 // info@riverbankcomputing.com. 16 // 17 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 18 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 19 20 21 #ifndef _QPYCORE_PYQTSIGNAL_H 22 #define _QPYCORE_PYQTSIGNAL_H 23 24 25 #include <Python.h> 26 #include <sip.h> 27 28 #include <QByteArray> 29 #include <QList> 30 31 #include "qpycore_chimera.h" 32 33 34 extern "C" { 35 36 // This defines the structure of a PyQt signal. 37 typedef struct _qpycore_pyqtSignal { 38 PyObject_HEAD 39 40 // The default signal. This is the head of the linked list of overloads 41 // and holds references to rest of the list elements. 42 struct _qpycore_pyqtSignal *default_signal; 43 44 // The next overload in the list. 45 struct _qpycore_pyqtSignal *next; 46 47 // The docstring. 48 const char *docstring; 49 50 // The optional parameter names. 51 const QList<QByteArray> *parameter_names; 52 53 // The revision. 54 int revision; 55 56 // The parsed signature, not set if there is an emitter. 57 Chimera::Signature *parsed_signature; 58 59 // An optional emitter. 60 pyqt5EmitFunc emitter; 61 62 // The non-signal overloads (if any). This is only set for the default. 63 PyMethodDef *non_signals; 64 } qpycore_pyqtSignal; 65 66 67 int qpycore_get_lazy_attr(const sipTypeDef *td, PyObject *dict); 68 69 } 70 71 72 // The type object. 73 extern PyTypeObject *qpycore_pyqtSignal_TypeObject; 74 75 76 bool qpycore_pyqtSignal_init_type(); 77 qpycore_pyqtSignal *qpycore_pyqtSignal_New(const char *signature, 78 bool *fatal = 0); 79 qpycore_pyqtSignal *qpycore_find_signal(qpycore_pyqtSignal *ps, 80 PyObject *subscript, const char *context); 81 void qpycore_set_signal_name(qpycore_pyqtSignal *ps, const char *type_name, 82 const char *name); 83 PyObject *qpycore_call_signal_overload(qpycore_pyqtSignal *ps, PyObject *bound, 84 PyObject *args, PyObject *kw); 85 86 87 #endif 88