|
QLua
Lua-Qt bindings
|
Manages Lua function invocation through Qt signals. And connection of Qt signals to Lua functions or QObject methods. More...
#include <LuaCallbackDispatcher.h>

Public Member Functions | |
| LuaCallbackDispatcher (QObject *parent=0) | |
| Standard QObject constructor. | |
| LuaCallbackDispatcher (LuaContext *lc) | |
| Constructor, bind dispatcher to Lua context. | |
| int | qt_metacall (QMetaObject::Call c, int id, void **arguments) |
| bool | Connect (QObject *obj, int signalIdx, const CBackParameterTypes ¶mTypes, int luaCBackRef) |
| bool | Disconnect (QObject *obj, int signalIdx, int cbackStackIndex) |
| void | SetLuaContext (LuaContext *lc) |
| Set LuaContext. | |
| virtual | ~LuaCallbackDispatcher () |
| Destructor: Clear method database. | |
Manages Lua function invocation through Qt signals. And connection of Qt signals to Lua functions or QObject methods.
Offers methods to connect Qt signals emitted from QObjects to Lua functions or other QObject methods. Whenever a new signal -> Lua 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 Lua 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.
| bool qlua::LuaCallbackDispatcher::Connect | ( | QObject * | obj, |
| int | signalIdx, | ||
| const CBackParameterTypes & | paramTypes, | ||
| int | luaCBackRef | ||
| ) |
Connect signal to Lua function
| obj | source QObject |
| signalIdx | signal index |
| paramTypes | signal signature |
| luaCBackRef | reference to Lua target function created through luaL_ref |
| bool qlua::LuaCallbackDispatcher::Disconnect | ( | QObject * | obj, |
| int | signalIdx, | ||
| int | cbackStackIndex | ||
| ) |
Disconnect signal from Lua function; function must be already on the stack
| obj | source QObject |
| signalIdx | signal index |
| cbackStackIndex | position of Lua function in Lua stack |
| int qlua::LuaCallbackDispatcher::qt_metacall | ( | QMetaObject::Call | c, |
| int | id, | ||
| void ** | arguments | ||
| ) |
Overridden method: This is what makes it possible to bind a signal to a Lua function through the index of a proxy method.
1.7.4