int PyQtSlotProxy::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: unislot(_a); break; case 1: disable(); break; } _id -= 2; } return _id; }
int PyQtProxy::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: if (type == ProxySignal) QMetaObject::activate(this, meta_object, _id, _a); else unislot(_a); break; case 1: disable(); break; } _id -= 2; } return _id; }
// Find a slot proxy connected to a transmitter. PyQtProxy *PyQtProxy::findSlotProxy(void *tx, const char *sig, PyObject *rxObj, const char *slot, const char **member) { PyQtProxy *proxy = 0; mutex->lock(); ProxyHash::const_iterator it(proxy_slots.find(tx)); ProxyHash::const_iterator end(proxy_slots.end()); while (it != end && it.key() == tx) { PyQtProxy *up = it.value(); if (up->signature == sig && sipSameSlot(&up->real_slot.sip_slot, rxObj, slot)) { *member = SLOT(unislot()); proxy = up; break; } ++it; } mutex->unlock(); return proxy; }
// Create a universal proxy used as a slot. Note that this will leak if there // is no signal transmitter (ie. no parent) and not marked as single shot. // There will be no meta-object if there was a problem creating the proxy. PyQtProxy::PyQtProxy(sipWrapper *txObj, const char *sig, PyObject *rxObj, const char *slot, const char **member, int flags) : QObject(), type(PyQtProxy::ProxySlot), proxy_flags(PROXY_OWNS_SLOT_SIG | flags), signature(QMetaObject::normalizedSignature(sig)), meta_object(0) { void *tx = 0; QObject *qtx = 0; // Parse the signature. SIP_BLOCK_THREADS real_slot.signature = Chimera::parse(signature, "a slot argument"); if (real_slot.signature) { // Save the slot. if (sipSaveSlot(&real_slot.sip_slot, rxObj, slot) < 0) { delete real_slot.signature; real_slot.signature = 0; } else { // See if there is a transmitter and that it is a QObject. if (txObj) { tx = sipGetCppPtr((sipSimpleWrapper *)txObj, 0); if (tx && PyObject_TypeCheck((PyObject *)txObj, sipTypeAsPyTypeObject(sipType_QObject))) qtx = reinterpret_cast<QObject *>(tx); } } } SIP_UNBLOCK_THREADS if (real_slot.signature) { // Return the slot to connect to. *member = SLOT(unislot()); init(qtx, &proxy_slots, tx); } }
// Create a universal proxy used as a slot being connected to a bound signal. // There will be no meta-object if there was a problem creating the proxy. PyQtProxy::PyQtProxy(qpycore_pyqtBoundSignal *bs, PyObject *rxObj, const char **member) : QObject(), type(PyQtProxy::ProxySlot), proxy_flags(0), signature(bs->unbound_signal->signature->signature) { SIP_BLOCK_THREADS real_slot.signature = bs->unbound_signal->signature; // Save the slot. if (sipSaveSlot(&real_slot.sip_slot, rxObj, 0) < 0) real_slot.signature = 0; SIP_UNBLOCK_THREADS if (real_slot.signature) { // Return the slot to connect to. *member = SLOT(unislot()); init(bs->bound_qobject, &proxy_slots, bs->bound_qobject); } }