add setCurrentStack

This commit is contained in:
Syping 2020-05-19 17:16:08 +02:00
parent 6de0b7af54
commit ff28849d90
2 changed files with 17 additions and 3 deletions

View file

@ -167,6 +167,7 @@ void LuaEngineGui::pushClass(lua_State *L_p)
pushFunction(L_p, "createStackSwitch", createStackSwitch);
pushFunction(L_p, "createWidgetStack", createWidgetStack);
pushFunction(L_p, "addWidgetAsStack", addWidgetAsStack);
pushFunction(L_p, "setCurrentStack", setCurrentStack);
// Tab Bar
pushFunction(L_p, "createTabBar", createTabBar);
@ -414,6 +415,18 @@ int LuaEngineGui::showWidget(lua_State *L_p)
return 0;
}
int LuaEngineGui::setCurrentStack(lua_State *L_p)
{
if (getArgumentCount(L_p) >= 2) {
void *w_pointer = getPointer(L_p, 1);
void *s_pointer = getPointer(L_p, 2);
if (w_pointer != NULL && s_pointer != NULL && ((QObject*)w_pointer)->inherits("QWidget") && ((QObject*)s_pointer)->inherits("QStackedWidget")) {
((QStackedWidget*)s_pointer)->setCurrentWidget((QWidget*)w_pointer);
}
}
return 0;
}
int LuaEngineGui::setLayoutMargins(lua_State *L_p)
{
if (getArgumentCount(L_p) >= 5) {
@ -822,9 +835,9 @@ int LuaEngineGui::addWidgetAsStack(lua_State *L_p)
{
if (getArgumentCount(L_p) >= 2) {
void *w_pointer = getPointer(L_p, 1);
void *t_pointer = getPointer(L_p, 2);
if (w_pointer != NULL && t_pointer != NULL && ((QObject*)w_pointer)->inherits("QWidget") && ((QObject*)t_pointer)->inherits("QStackedWidget")) {
((QStackedWidget*)t_pointer)->addWidget((QWidget*)w_pointer);
void *s_pointer = getPointer(L_p, 2);
if (w_pointer != NULL && s_pointer != NULL && ((QObject*)w_pointer)->inherits("QWidget") && ((QObject*)s_pointer)->inherits("QStackedWidget")) {
((QStackedWidget*)s_pointer)->addWidget((QWidget*)w_pointer);
}
}
return 0;

View file

@ -38,6 +38,7 @@ public:
static int closeWidget(lua_State *L_p);
static int executeWidget(lua_State *L_p);
static int showWidget(lua_State *L_p);
static int setCurrentStack(lua_State *L_p);
static int setLayoutMargins(lua_State *L_p);
static int setMenuShortcut(lua_State *L_p);
static int setObjectImage(lua_State *L_p);