mirror of
https://gitlab.com/Syping/luaengineapp.git
synced 2024-12-22 11:55:29 +01:00
add readOnly
This commit is contained in:
parent
a37b496674
commit
a22f961ac8
2 changed files with 26 additions and 0 deletions
|
@ -78,6 +78,7 @@ void LuaEngineGui::pushClass(lua_State *L_p)
|
||||||
pushFunction(L_p, "setWidgetFixed", setWidgetFixed);
|
pushFunction(L_p, "setWidgetFixed", setWidgetFixed);
|
||||||
pushFunction(L_p, "setWidgetLayout", setWidgetLayout);
|
pushFunction(L_p, "setWidgetLayout", setWidgetLayout);
|
||||||
pushFunction(L_p, "setWidgetText", setWidgetText);
|
pushFunction(L_p, "setWidgetText", setWidgetText);
|
||||||
|
pushFunction(L_p, "setWidgetReadOnly", setWidgetReadOnly);
|
||||||
pushFunction(L_p, "setWidgetSize", setWidgetSize);
|
pushFunction(L_p, "setWidgetSize", setWidgetSize);
|
||||||
pushVariant(L_p, "ShowCurrent", 0);
|
pushVariant(L_p, "ShowCurrent", 0);
|
||||||
pushVariant(L_p, "ShowNormal", 1);
|
pushVariant(L_p, "ShowNormal", 1);
|
||||||
|
@ -410,6 +411,30 @@ int LuaEngineGui::setWidgetEnabled(lua_State *L_p)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int LuaEngineGui::setWidgetReadOnly(lua_State *L_p)
|
||||||
|
{
|
||||||
|
if (getArgumentCount(L_p) >= 1) {
|
||||||
|
void *pointer = getPointer(L_p, 1);
|
||||||
|
if (pointer != NULL) {
|
||||||
|
bool isReadOnly = true;
|
||||||
|
if (getArgumentCount(L_p) >= 2) {
|
||||||
|
isReadOnly = getVariant(L_p, 2).toBool();
|
||||||
|
}
|
||||||
|
if (((QObject*)pointer)->inherits("QPlainTextEdit")) {
|
||||||
|
((QPlainTextEdit*)pointer)->setReadOnly(isReadOnly);
|
||||||
|
}
|
||||||
|
else if (((QObject*)pointer)->inherits("QTextEdit")) {
|
||||||
|
((QTextEdit*)pointer)->setReadOnly(isReadOnly);
|
||||||
|
}
|
||||||
|
else if (((QObject*)pointer)->inherits("QLineEdit")) {
|
||||||
|
((QLineEdit*)pointer)->setReadOnly(isReadOnly);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int LuaEngineGui::setWidgetFixed(lua_State *L_p)
|
int LuaEngineGui::setWidgetFixed(lua_State *L_p)
|
||||||
{
|
{
|
||||||
if (getArgumentCount(L_p) >= 1) {
|
if (getArgumentCount(L_p) >= 1) {
|
||||||
|
|
|
@ -41,6 +41,7 @@ public:
|
||||||
static int setWidgetEnabled(lua_State *L_p);
|
static int setWidgetEnabled(lua_State *L_p);
|
||||||
static int setWidgetFixed(lua_State *L_p);
|
static int setWidgetFixed(lua_State *L_p);
|
||||||
static int setWidgetLayout(lua_State *L_p);
|
static int setWidgetLayout(lua_State *L_p);
|
||||||
|
static int setWidgetReadOnly(lua_State *L_p);
|
||||||
static int setWidgetSize(lua_State *L_p);
|
static int setWidgetSize(lua_State *L_p);
|
||||||
static int setWidgetText(lua_State *L_p);
|
static int setWidgetText(lua_State *L_p);
|
||||||
static int layoutAddLayout(lua_State *L_p);
|
static int layoutAddLayout(lua_State *L_p);
|
||||||
|
|
Loading…
Reference in a new issue