QPy
Python-Qt dynamic bindings
 All Classes Namespaces Files Functions
Public Member Functions
qpy::PyCallbackDispatcher Class Reference

Manages Python function invocation through Qt signals. And connection of Qt signals to Python functions or QObject methods. More...

#include <PyCallbackDispatcher.h>

List of all members.

Public Member Functions

 PyCallbackDispatcher (QObject *parent=0)
 Standard QObject constructor.
 PyCallbackDispatcher (PyContext *pc, PyObject *pm, QObject *parent=0)
 Constructor, bind dispatcher to Lua context.
int qt_metacall (QMetaObject::Call c, int id, void **arguments)
bool Connect (QObject *obj, int signalIdx, const CBackParameterTypes &paramTypes, PyCBack pyCBack, PyObject *module)
bool Disconnect (QObject *obj, int signalIdx, PyCBack pyCBack)
void SetPyContext (PyContext *pc)
 Set Python context.
virtual ~PyCallbackDispatcher ()
 Destructor: Clear method database.

Detailed Description

Manages Python function invocation through Qt signals. And connection of Qt signals to Python functions or QObject methods.

Exposes methods to connect Qt signals emitted from QObjects to Python functions or other QObject methods. Whenever a new signal -> Python connection is requested a new proxy method is generated and the signal is routed to the new method which in turn takes care of invoking the Python function. Note that when disconnecting a signal the associated method is not currently removed from the method array because signals are connected to methods through the method's position in the method array, thus removing a method from the array invalidates all the signal to method connections for which the method index is greater than the one of the removed method.


Member Function Documentation

bool qpy::PyCallbackDispatcher::Connect ( QObject *  obj,
int  signalIdx,
const CBackParameterTypes &  paramTypes,
PyCBack  pyCBack,
PyObject *  module 
)

Connect signal to Python function

Parameters:
modulePython module; used in case new QObjects need to be added as result of triggered signals
objsource QObject
signalIdxsignal index
paramTypessignal signature
pyCBackreference to Python target function
bool qpy::PyCallbackDispatcher::Disconnect ( QObject *  obj,
int  signalIdx,
PyCBack  pyCBack 
)

Disconnect signal from Python function

Parameters:
objsource QObject
signalIdxsignal index
pyCBackPython function
int qpy::PyCallbackDispatcher::qt_metacall ( QMetaObject::Call  c,
int  id,
void **  arguments 
)

Overridden method: This is what makes it possible to bind a signal to a Python function through the index of a proxy method.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions