mirror of
https://gitlab.com/Syping/luaengineapp.git
synced 2024-11-04 21:16:56 +01:00
add setWidgetEnabled
This commit is contained in:
parent
db9ae56fb2
commit
a37b496674
2 changed files with 20 additions and 0 deletions
|
@ -74,6 +74,7 @@ void LuaEngineGui::pushClass(lua_State *L_p)
|
|||
pushFunction(L_p, "isWidgetChecked", isWidgetChecked);
|
||||
pushFunction(L_p, "getWidgetText", getWidgetText);
|
||||
pushFunction(L_p, "setWidgetChecked", setWidgetChecked);
|
||||
pushFunction(L_p, "setWidgetEnabled", setWidgetEnabled);
|
||||
pushFunction(L_p, "setWidgetFixed", setWidgetFixed);
|
||||
pushFunction(L_p, "setWidgetLayout", setWidgetLayout);
|
||||
pushFunction(L_p, "setWidgetText", setWidgetText);
|
||||
|
@ -391,6 +392,24 @@ int LuaEngineGui::setWidgetChecked(lua_State *L_p)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int LuaEngineGui::setWidgetEnabled(lua_State *L_p)
|
||||
{
|
||||
if (getArgumentCount(L_p) >= 1) {
|
||||
void *pointer = getPointer(L_p, 1);
|
||||
if (pointer != NULL) {
|
||||
bool isEnabled = true;
|
||||
if (getArgumentCount(L_p) >= 2) {
|
||||
isEnabled = getVariant(L_p, 2).toBool();
|
||||
}
|
||||
if (((QObject*)pointer)->inherits("QWidget")) {
|
||||
((QWidget*)pointer)->setEnabled(isEnabled);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int LuaEngineGui::setWidgetFixed(lua_State *L_p)
|
||||
{
|
||||
if (getArgumentCount(L_p) >= 1) {
|
||||
|
|
|
@ -38,6 +38,7 @@ public:
|
|||
static int setLayoutMargins(lua_State *L_p);
|
||||
static int setMenuShortcut(lua_State *L_p);
|
||||
static int setWidgetChecked(lua_State *L_p);
|
||||
static int setWidgetEnabled(lua_State *L_p);
|
||||
static int setWidgetFixed(lua_State *L_p);
|
||||
static int setWidgetLayout(lua_State *L_p);
|
||||
static int setWidgetSize(lua_State *L_p);
|
||||
|
|
Loading…
Reference in a new issue