mirror of
https://gitlab.com/Syping/luaengineapp.git
synced 2024-11-04 21:16:56 +01:00
setLayoutMargins added
This commit is contained in:
parent
b8a5843464
commit
7ae82a4e32
3 changed files with 15 additions and 1 deletions
|
@ -25,6 +25,7 @@ function main()
|
|||
mainWindow = createMainWindow()
|
||||
local mainWidget = createCentralWidget(mainWindow)
|
||||
local mainLayout = createLayout(VerticalLayout, mainWidget)
|
||||
setLayoutMargins(mainLayout, 0, 0, 0, 0)
|
||||
|
||||
local menuBar = createMenuBar(mainWindow)
|
||||
local menuFile = createMenu("File", menuBar)
|
||||
|
|
|
@ -84,6 +84,7 @@ void LuaEngineGui::pushClass(lua_State *L_p)
|
|||
pushFunction(L_p, "createLayout", createLayout);
|
||||
pushFunction(L_p, "layoutAddLayout", layoutAddLayout);
|
||||
pushFunction(L_p, "layoutAddWidget", layoutAddWidget);
|
||||
pushFunction(L_p, "setLayoutMargins", setLayoutMargins);
|
||||
pushVariant(L_p, "HorizontalLayout", 0);
|
||||
pushVariant(L_p, "VerticalLayout", 1);
|
||||
|
||||
|
@ -254,6 +255,18 @@ int LuaEngineGui::showWidget(lua_State *L_p)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int LuaEngineGui::setLayoutMargins(lua_State *L_p)
|
||||
{
|
||||
if (getArgumentCount(L_p) >= 5) {
|
||||
void *pointer = getPointer(L_p, 1);
|
||||
if (pointer != NULL && ((QObject*)pointer)->inherits("QLayout")) {
|
||||
((QLayout*)pointer)->setContentsMargins(getVariant(L_p, 2).toInt(), getVariant(L_p, 3).toInt(), getVariant(L_p, 4).toInt(), getVariant(L_p, 5).toInt());
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
int LuaEngineGui::setWidgetFixedSize(lua_State *L_p)
|
||||
{
|
||||
if (getArgumentCount(L_p) >= 1) {
|
||||
|
|
|
@ -34,9 +34,9 @@ public:
|
|||
static int closeWidget(lua_State *L_p);
|
||||
static int executeWidget(lua_State *L_p);
|
||||
static int showWidget(lua_State *L_p);
|
||||
static int setLayoutMargins(lua_State *L_p);
|
||||
static int setWidgetFixedSize(lua_State *L_p);
|
||||
static int setWidgetLayout(lua_State *L_p);
|
||||
static int setWidgetMargins(lua_State *L_p);
|
||||
static int setWidgetText(lua_State *L_p);
|
||||
static int layoutAddLayout(lua_State *L_p);
|
||||
static int layoutAddWidget(lua_State *L_p);
|
||||
|
|
Loading…
Reference in a new issue