8 const int destroySignalId =
_object->metaObject()->indexOfSignal(
"destroyed()");
9 QMetaObject::connect(
_object, destroySignalId,
this, metaObject()->methodCount());
18 if(slot.isFunction()) {
21 if(QMetaObject::connect(
_object, signalId,
this, this->metaObject()->methodCount() +
_slotId)) {
27 std::cerr <<
"Given slot is not a function" << std::endl;
35 id = QObject::qt_metacall(c,
id, a);
47 for (
auto parameter : parameters) {
49 pushArg(s, QMetaType::type(parameter.constData()), a[i]);
62 return object->objectName().toStdString();
75 for(
auto child : object->children()) {
81 std::cout <<
"Child " << name <<
" not found." << std::endl;
95 if(type == qRegisterMetaType<lc::geo::Coordinate>()) {
96 s.push(*(lc::geo::Coordinate*) arg);
101 case QMetaType::Void:
104 case QMetaType::Bool:
105 s.push(*(
bool *) arg);
108 s.push(*(
int *) arg);
110 case QMetaType::UInt:
111 s.push(*(
unsigned int *) arg);
113 case QMetaType::Long:
114 s.push(*(
long *) arg);
116 case QMetaType::LongLong:
117 s.push(*(
long long *) arg);
119 case QMetaType::Short:
120 s.push(*(
short *) arg);
122 case QMetaType::Char:
123 s.push(*(
char *) arg);
125 case QMetaType::ULong:
126 s.push(*(
unsigned long *) arg);
128 case QMetaType::ULongLong:
129 s.push(*(
unsigned long long *) arg);
131 case QMetaType::UShort:
132 s.push(*(
unsigned short *) arg);
134 case QMetaType::UChar:
135 s.push(*(
unsigned char *) arg);
137 case QMetaType::Double:
138 s.push(*(
double *) arg);
140 case QMetaType::Float:
141 s.push(*(
float *) arg);
143 case QMetaType::QString:
144 s.push(reinterpret_cast<const QString *>(arg));
bool connect(int signalId, LuaIntf::LuaRef slot)
Connect Qt slot to Lua function.
std::string objectName()
Get object name.
bool valid()
Return object validity.
LuaIntf::LuaRef _slotFunction
void pushArg(LuaIntf::LuaState s, int const type, void const *arg)
Add signal parameter.
LuaQObject(QObject *object)
Create QObject wrapper.
QObject * findChild(std::string name)
Find children by name.
int qt_metacall(QMetaObject::Call c, int id, void **a)
Internal Qt function This function is called when a slot of this object is called. It gets the arguments and call the Lua function.