C++ method abstraction: Qt signals are connected to instances of this class which invokes associated Python functions through the Invoke
method.
More...
#include <PyCallbackDispatcher.h>
Public Member Functions | |
PyCBackMethod (PyContext *pc, PyObject *pm, const CBackParameterTypes &p, PyObject *pyCBack) | |
Constructor. | |
void | Invoke (void **arguments) |
Called by QObject::qt_metacall as part of a signal-method invocation. | |
PyObject * | CBack () const |
Return associated reference to Python function. | |
void | DeleteCBack () |
C++ method abstraction: Qt signals are connected to instances of this class which invokes associated Python functions through the Invoke
method.
At signal connection time a signal is connected to a dynamically created instance of this class which stores internally a reference to the Python function to invoke.
qpy::PyCBackMethod::PyCBackMethod | ( | PyContext * | pc, |
PyObject * | pm, | ||
const CBackParameterTypes & | p, | ||
PyObject * | pyCBack | ||
) | [inline] |
Constructor.
pc | PyContext |
p | signal signature: This information is used to translate the parameter values received from the signal (as an array of void*) into Python values |
pyCBack | reference to Python function to invoke |
void qpy::PyCBackMethod::DeleteCBack | ( | ) | [inline] |
This is required to release the bound function when disconnect is invoked since methods are never removed from the list to maintain consistency between the method id and the position in the list itself
void qpy::PyCBackMethod::Invoke | ( | void ** | arguments | ) |
Called by QObject::qt_metacall as part of a signal-method invocation.
Iterates over the list of arguments and parameter types in parallel and for each argument uses the corresponding parameter wrapper to create PyObjects from Qt types. Values which are of QObject* type are automatically translated to PyQObject QObjects added to the Python contexts are not owned by Python.