From 3f951b3734af4fdc1ecf68f886e76b6c59ed9bd3 Mon Sep 17 00:00:00 2001 From: Michall Kottman Date: Mon, 28 Nov 2011 02:36:29 +0100 Subject: [PATCH] Make QVariant::setValue work for classes from QtGui module --- CMakeLists.txt | 2 +- common/lqt_qt.cpp | 9 +++++++-- common/lqt_qt.hpp | 5 +++++ generator/classes.lua | 4 +++- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ab7676b..740217b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,7 +64,7 @@ if(WIN32) endif() set(LUA_LIBS_FOR_MODULE ${LUA_LIBRARIES}) else(WIN32) - set(LUA_LIBS__FOR_MODULE ) + set(LUA_LIBS_FOR_MODULE ) endif(WIN32) if(APPLE) diff --git a/common/lqt_qt.cpp b/common/lqt_qt.cpp index cef7792..76418ea 100644 --- a/common/lqt_qt.cpp +++ b/common/lqt_qt.cpp @@ -518,7 +518,12 @@ int lqtL_qvariant_value(lua_State *L) { return 0; } -void lqtL_qvariant_custom(lua_State *L) { +#ifndef MODULE_qtgui +void lqtL_qvariant_custom(lua_State *L) +#else +void lqtL_qvariant_custom_qtgui(lua_State *L) +#endif +{ lua_getfield(L, LUA_REGISTRYINDEX, "QVariant*"); int qvariant = lua_gettop(L); @@ -529,5 +534,5 @@ void lqtL_qvariant_custom(lua_State *L) { lua_pushliteral(L, "setValue"); lua_pushcfunction(L, lqtL_qvariant_setValue); lua_rawset(L, qvariant); - } + diff --git a/common/lqt_qt.hpp b/common/lqt_qt.hpp index a43a2f9..0cc1094 100644 --- a/common/lqt_qt.hpp +++ b/common/lqt_qt.hpp @@ -26,7 +26,12 @@ int lqtL_qt_metacall (lua_State *, QObject *, QObject *, QMetaObject::Call, const char *, int, void **); void lqtL_qobject_custom (lua_State *L); + +#ifndef MODULE_qtgui void lqtL_qvariant_custom (lua_State *L); +#else +void lqtL_qvariant_custom_qtgui (lua_State *L); +#endif // custom type handlers diff --git a/generator/classes.lua b/generator/classes.lua index 5565607..a763a9d 100644 --- a/generator/classes.lua +++ b/generator/classes.lua @@ -864,8 +864,10 @@ end if qobject_present then print_meta('\tlqtL_qobject_custom(L);') end - if module_name == "qtcore" or module_name == "qtgui" then + if module_name == "qtcore" then print_meta("\tlqtL_qvariant_custom(L);") + elseif module_name == "qtgui" then + print_meta("\tlqtL_qvariant_custom_qtgui(L);") end print_meta('\tlqtL_register_super(L);') print_meta('\tlqtSlotAcceptor_'..module_name..' = new LqtSlotAcceptor(L);') -- 2.11.4.GIT