Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions generator/classes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1053,29 +1053,29 @@ private:
#include <QDebug>

const QMetaObject *lqt_shell_]]..n..[[::metaObject() const {
if (!lqtL_isMainThread()) {
printf("Warning: call ]]..c.xarg.fullname..[[::metaObject() from thread!\n");
return &]]..c.xarg.fullname..[[::staticMetaObject;
}

const QMetaObject& meta = lqtL_qt_metaobject(L
, "]]..c.xarg.fullname..[[*"
, this
, ]]..c.xarg.fullname..[[::staticMetaObject
);
return &meta;
if (!lqtL_isMainThread()) {
printf("Warning: call ]]..c.xarg.fullname..[[::metaObject() from thread!\n");
return &]]..c.xarg.fullname..[[::staticMetaObject;
}

const QMetaObject& meta = lqtL_qt_metaobject(L
, "]]..c.xarg.fullname..[[*"
, this
, ]]..c.xarg.fullname..[[::staticMetaObject
);
return &meta;
}

int lqt_shell_]]..n..[[::qt_metacall(QMetaObject::Call call, int index, void **args) {
//qDebug() << "fake calling!";
index = ]]..c.xarg.fullname..[[::qt_metacall(call, index, args);
if (!lqtL_isMainThread()) {
printf("Warning: call ]]..c.xarg.fullname..[[::qt_metacall() from thread!\n");
return index;
}
if (index < 0)
return index;
return lqtL_qt_metacall(L, this, lqtSlotAcceptor_]]..module_name..[[, call, "]]..c.xarg.fullname..[[*", index, args);
//qDebug() << "fake calling!";
index = ]]..c.xarg.fullname..[[::qt_metacall(call, index, args);
if (!lqtL_isMainThread()) {
printf("Warning: call ]]..c.xarg.fullname..[[::qt_metacall() from thread!\n");
return index;
}
if (index < 0)
return index;
return lqtL_qt_metacall(L, this, lqtSlotAcceptor_]]..module_name..[[[L].get(), call, "]]..c.xarg.fullname..[[*", index, args);
}
]])
end
Expand Down Expand Up @@ -1270,7 +1270,7 @@ end
print_meta("\tlqtL_qvariant_custom_qtgui(L);")
end
print_meta('\tlqtL_register_super(L);')
print_meta('\tlqtSlotAcceptor_'..module_name..' = new LqtSlotAcceptor(L);')
print_meta('\tlqtSlotAcceptor_'..module_name..'[L] = std::unique_ptr<LqtSlotAcceptor>(new LqtSlotAcceptor(L));')
print_meta('\tlua_settop(L, top);')
print_meta('\treturn 1;\n}')
if fmeta then fmeta:close() end
Expand Down
8 changes: 5 additions & 3 deletions generator/signalslot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,17 @@ function print_slots(s)
print_slot_h' lua_State *L;'
print_slot_h' public:'
print_slot_h(' LqtSlotAcceptor(lua_State *l, QObject *p=NULL) : QObject(p), L(l) { setObjectName("'..module_name..'"); lqtL_register(L, this, NULL); }')
print_slot_h' virtual ~LqtSlotAcceptor() { lqtL_unregister(L, this, NULL); }'
print_slot_h' virtual ~LqtSlotAcceptor() { /*lqtL_unregister(L, this, NULL);*/ }'
print_slot_h' public slots:'
for p, b in pairs(s) do
print_slot_h(' '..p..';')
print_slot_c(b)
end
print_slot_h'};\n'
print_slot_h('\nextern LqtSlotAcceptor *lqtSlotAcceptor_'..module_name..';')
print_slot_c('\nLqtSlotAcceptor *lqtSlotAcceptor_'..module_name..';')
print_slot_h('\n#include <map>')
print_slot_h('\n#include <memory>')
print_slot_h('\nextern std::map<lua_State*,std::unique_ptr<LqtSlotAcceptor>> lqtSlotAcceptor_'..module_name..';')
print_slot_c('\nstd::map<lua_State*,std::unique_ptr<LqtSlotAcceptor>> lqtSlotAcceptor_'..module_name..';')
end


Expand Down