mirror of
https://gitlab.com/Syping/luaengineapp.git
synced 2024-12-22 11:55:29 +01:00
fix lpForPointer function
This commit is contained in:
parent
807bcdd597
commit
1823511204
2 changed files with 17 additions and 17 deletions
|
@ -720,7 +720,7 @@ int LuaEngineGui::createCheckBox(lua_State *L_p)
|
||||||
if (getArgumentCount(L_p) >= 1) {
|
if (getArgumentCount(L_p) >= 1) {
|
||||||
labelText = getVariant(L_p, 1).toString();
|
labelText = getVariant(L_p, 1).toString();
|
||||||
if (getArgumentCount(L_p) >= 2) {
|
if (getArgumentCount(L_p) >= 2) {
|
||||||
lpForPointer(getPointer(L_p, 2), layout, parent);
|
lpForPointer(getPointer(L_p, 2), &layout, &parent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QCheckBox *checkBox = new QCheckBox(parent);
|
QCheckBox *checkBox = new QCheckBox(parent);
|
||||||
|
@ -766,7 +766,7 @@ int LuaEngineGui::createGroupBox(lua_State *L_p)
|
||||||
if (getArgumentCount(L_p) >= 1) {
|
if (getArgumentCount(L_p) >= 1) {
|
||||||
groupBoxTitle = getVariant(L_p, 1).toString();
|
groupBoxTitle = getVariant(L_p, 1).toString();
|
||||||
if (getArgumentCount(L_p) >= 2) {
|
if (getArgumentCount(L_p) >= 2) {
|
||||||
lpForPointer(getPointer(L_p, 2), layout, parent);
|
lpForPointer(getPointer(L_p, 2), &layout, &parent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QGroupBox *groupBox = new QGroupBox(parent);
|
QGroupBox *groupBox = new QGroupBox(parent);
|
||||||
|
@ -787,7 +787,7 @@ int LuaEngineGui::createLabel(lua_State *L_p)
|
||||||
if (getArgumentCount(L_p) >= 1) {
|
if (getArgumentCount(L_p) >= 1) {
|
||||||
labelText = getVariant(L_p, 1).toString();
|
labelText = getVariant(L_p, 1).toString();
|
||||||
if (getArgumentCount(L_p) >= 2) {
|
if (getArgumentCount(L_p) >= 2) {
|
||||||
lpForPointer(getPointer(L_p, 2), layout, parent);
|
lpForPointer(getPointer(L_p, 2), &layout, &parent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QLabel *label = new QLabel(parent);
|
QLabel *label = new QLabel(parent);
|
||||||
|
@ -849,7 +849,7 @@ int LuaEngineGui::createLineEdit(lua_State *L_p)
|
||||||
if (getArgumentCount(L_p) >= 1) {
|
if (getArgumentCount(L_p) >= 1) {
|
||||||
editText = getVariant(L_p, 1).toString();
|
editText = getVariant(L_p, 1).toString();
|
||||||
if (getArgumentCount(L_p) >= 2) {
|
if (getArgumentCount(L_p) >= 2) {
|
||||||
lpForPointer(getPointer(L_p, 2), layout, parent);
|
lpForPointer(getPointer(L_p, 2), &layout, &parent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QLineEdit *lineEdit = new QLineEdit(parent);
|
QLineEdit *lineEdit = new QLineEdit(parent);
|
||||||
|
@ -970,7 +970,7 @@ int LuaEngineGui::createPlainTextEdit(lua_State *L_p)
|
||||||
if (getArgumentCount(L_p) >= 1) {
|
if (getArgumentCount(L_p) >= 1) {
|
||||||
editText = getVariant(L_p, 1).toString();
|
editText = getVariant(L_p, 1).toString();
|
||||||
if (getArgumentCount(L_p) >= 2) {
|
if (getArgumentCount(L_p) >= 2) {
|
||||||
lpForPointer(getPointer(L_p, 2), layout, parent);
|
lpForPointer(getPointer(L_p, 2), &layout, &parent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QPlainTextEdit *textEdit = new QPlainTextEdit(parent);
|
QPlainTextEdit *textEdit = new QPlainTextEdit(parent);
|
||||||
|
@ -993,7 +993,7 @@ int LuaEngineGui::createProgressBar(lua_State *L_p)
|
||||||
if (getArgumentCount(L_p) >= 1) {
|
if (getArgumentCount(L_p) >= 1) {
|
||||||
value = getVariant(L_p, 1).toInt();
|
value = getVariant(L_p, 1).toInt();
|
||||||
if (getArgumentCount(L_p) >= 2) {
|
if (getArgumentCount(L_p) >= 2) {
|
||||||
lpForPointer(getPointer(L_p, 2), layout, parent);
|
lpForPointer(getPointer(L_p, 2), &layout, &parent);
|
||||||
if (getArgumentCount(L_p) >= 4) {
|
if (getArgumentCount(L_p) >= 4) {
|
||||||
minValue = getVariant(L_p, 3).toInt();
|
minValue = getVariant(L_p, 3).toInt();
|
||||||
maxValue = getVariant(L_p, 4).toInt();
|
maxValue = getVariant(L_p, 4).toInt();
|
||||||
|
@ -1020,7 +1020,7 @@ int LuaEngineGui::createPushButton(lua_State *L_p)
|
||||||
if (getArgumentCount(L_p) >= 1) {
|
if (getArgumentCount(L_p) >= 1) {
|
||||||
buttonText = getVariant(L_p, 1).toString();
|
buttonText = getVariant(L_p, 1).toString();
|
||||||
if (getArgumentCount(L_p) >= 2) {
|
if (getArgumentCount(L_p) >= 2) {
|
||||||
lpForPointer(getPointer(L_p, 2), layout, parent);
|
lpForPointer(getPointer(L_p, 2), &layout, &parent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QPushButton *pushButton = new QPushButton(parent);
|
QPushButton *pushButton = new QPushButton(parent);
|
||||||
|
@ -1041,7 +1041,7 @@ int LuaEngineGui::createRadioButton(lua_State *L_p)
|
||||||
if (getArgumentCount(L_p) >= 1) {
|
if (getArgumentCount(L_p) >= 1) {
|
||||||
labelText = getVariant(L_p, 1).toString();
|
labelText = getVariant(L_p, 1).toString();
|
||||||
if (getArgumentCount(L_p) >= 2) {
|
if (getArgumentCount(L_p) >= 2) {
|
||||||
lpForPointer(getPointer(L_p, 2), layout, parent);
|
lpForPointer(getPointer(L_p, 2), &layout, &parent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QRadioButton *radioButton = new QRadioButton(parent);
|
QRadioButton *radioButton = new QRadioButton(parent);
|
||||||
|
@ -1083,7 +1083,7 @@ int LuaEngineGui::createTabBar(lua_State *L_p)
|
||||||
QLayout *layout = nullptr;
|
QLayout *layout = nullptr;
|
||||||
QWidget *parent = nullptr;
|
QWidget *parent = nullptr;
|
||||||
if (getArgumentCount(L_p) >= 1) {
|
if (getArgumentCount(L_p) >= 1) {
|
||||||
lpForPointer(getPointer(L_p, 1), layout, parent);
|
lpForPointer(getPointer(L_p, 1), &layout, &parent);
|
||||||
}
|
}
|
||||||
QTabWidget *tabWidget = new QTabWidget(parent);
|
QTabWidget *tabWidget = new QTabWidget(parent);
|
||||||
tabWidget->setObjectName(nameForPointer(tabWidget));
|
tabWidget->setObjectName(nameForPointer(tabWidget));
|
||||||
|
@ -1102,7 +1102,7 @@ int LuaEngineGui::createTextEdit(lua_State *L_p)
|
||||||
if (getArgumentCount(L_p) >= 1) {
|
if (getArgumentCount(L_p) >= 1) {
|
||||||
editText = getVariant(L_p, 1).toString();
|
editText = getVariant(L_p, 1).toString();
|
||||||
if (getArgumentCount(L_p) >= 2) {
|
if (getArgumentCount(L_p) >= 2) {
|
||||||
lpForPointer(getPointer(L_p, 2), layout, parent);
|
lpForPointer(getPointer(L_p, 2), &layout, &parent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QTextEdit *textEdit = new QTextEdit(parent);
|
QTextEdit *textEdit = new QTextEdit(parent);
|
||||||
|
@ -1123,7 +1123,7 @@ int LuaEngineGui::createToolButton(lua_State *L_p)
|
||||||
if (getArgumentCount(L_p) >= 1) {
|
if (getArgumentCount(L_p) >= 1) {
|
||||||
buttonText = getVariant(L_p, 1).toString();
|
buttonText = getVariant(L_p, 1).toString();
|
||||||
if (getArgumentCount(L_p) >= 2) {
|
if (getArgumentCount(L_p) >= 2) {
|
||||||
lpForPointer(getPointer(L_p, 2), layout, parent);
|
lpForPointer(getPointer(L_p, 2), &layout, &parent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QToolButton *toolButton = new QToolButton(parent);
|
QToolButton *toolButton = new QToolButton(parent);
|
||||||
|
@ -1263,19 +1263,19 @@ QWidget* LuaEngineGui::windowForObject(QObject *object)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LuaEngineGui::lpForPointer(void *pointer, QLayout *layout, QWidget *parent)
|
void LuaEngineGui::lpForPointer(void *pointer, QLayout **layout, QWidget **parent)
|
||||||
{
|
{
|
||||||
if (pointer != NULL && ((QObject*)pointer)->inherits("QMainWindow")) {
|
if (pointer != NULL && ((QObject*)pointer)->inherits("QMainWindow")) {
|
||||||
parent = ((QMainWindow*)pointer)->centralWidget();
|
*parent = ((QMainWindow*)pointer)->centralWidget();
|
||||||
}
|
}
|
||||||
else if (pointer != NULL && ((QObject*)pointer)->inherits("QWidget")) {
|
else if (pointer != NULL && ((QObject*)pointer)->inherits("QWidget")) {
|
||||||
parent = (QWidget*)pointer;
|
*parent = (QWidget*)pointer;
|
||||||
}
|
}
|
||||||
else if (pointer != NULL && ((QObject*)pointer)->inherits("QLayout")) {
|
else if (pointer != NULL && ((QObject*)pointer)->inherits("QLayout")) {
|
||||||
QWidget *widget = windowForObject((QObject*)pointer);
|
QWidget *widget = windowForObject((QObject*)pointer);
|
||||||
if (widget != nullptr) {
|
if (widget != nullptr) {
|
||||||
layout = (QLayout*)pointer;
|
*layout = (QLayout*)pointer;
|
||||||
parent = widget;
|
*parent = widget;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ public:
|
||||||
private:
|
private:
|
||||||
lua_State *L;
|
lua_State *L;
|
||||||
static QWidget* windowForObject(QObject *object);
|
static QWidget* windowForObject(QObject *object);
|
||||||
static void lpForPointer(void *pointer, QLayout *layout, QWidget *parent);
|
static void lpForPointer(void *pointer, QLayout **layout, QWidget **parent);
|
||||||
static QString nameForPointer(void *pointer);
|
static QString nameForPointer(void *pointer);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue