Merge branch 'master' of gitlab.com:Syping/luaengineapp

This commit is contained in:
Syping 2018-09-09 18:58:35 +02:00
commit 47fbb8c2a9
3 changed files with 16 additions and 7 deletions

View file

@ -46,7 +46,7 @@ function main()
layoutAddWidget(mainLayout, pushButton1) layoutAddWidget(mainLayout, pushButton1)
connect(pushButton1, "clicked()", "showDialog") connect(pushButton1, "clicked()", "showDialog")
setWidgetFixedSize(mainWindow) setWidgetFixed(mainWindow)
showWidget(mainWindow, ShowNormal) showWidget(mainWindow, ShowNormal)
return GuiExecuted return GuiExecuted
end end
@ -71,7 +71,7 @@ function showDialog(pushButton)
local dialogButton = createPushButton("Close", dialog) local dialogButton = createPushButton("Close", dialog)
layoutAddWidget(buttonLayout, dialogButton) layoutAddWidget(buttonLayout, dialogButton)
connect(dialogButton, "clicked()", "closeDialog") connect(dialogButton, "clicked()", "closeDialog")
setWidgetFixedSize(dialog) setWidgetFixed(dialog)
executeWidget(dialog) executeWidget(dialog)
delete(dialog, DeleteInstant) delete(dialog, DeleteInstant)
end end

View file

@ -28,7 +28,9 @@
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
QApplication a(argc, argv); QApplication a(argc, argv);
#ifdef _WIN32
QApplication::setStyle(new LuaEngineStyle()); QApplication::setStyle(new LuaEngineStyle());
#endif
#ifdef _WIN32 #ifdef _WIN32
#if QT_VERSION >= 0x050400 #if QT_VERSION >= 0x050400
@ -45,14 +47,16 @@ int main(int argc, char *argv[])
#endif #endif
#endif #endif
#ifdef _WIN32
QFile *luaEngineStyleFile = new QFile(":/luaenginestyle/luaenginestyle.qss"); QFile *luaEngineStyleFile = new QFile(":/luaenginestyle/luaenginestyle.qss");
if (luaEngineStyleFile->open(QFile::ReadOnly)) if (luaEngineStyleFile->open(QFile::ReadOnly))
{ {
a.setStyleSheet(QString::fromUtf8(luaEngineStyleFile->readAll())); a.setStyleSheet(QString::fromUtf8(luaEngineStyleFile->readAll()));
} }
delete luaEngineStyleFile; delete luaEngineStyleFile;
#endif
QFile luaScript(":/lua/edit.lua"); QFile luaScript(":/lua/app.lua");
LuaEngineGui luaEngineGui; LuaEngineGui luaEngineGui;
luaEngineGui.executeLuaScript(&luaScript); luaEngineGui.executeLuaScript(&luaScript);
@ -79,9 +83,6 @@ int main(int argc, char *argv[])
return 1; return 1;
} }
} }
else {
return 1;
}
return a.exec(); return 1;
} }

View file

@ -173,7 +173,11 @@ int LuaEngineGui::showFileDialog(lua_State *L_p)
} }
} }
QFileDialog fileDialog(parent); QFileDialog fileDialog(parent);
#if QT_VERSION >= 0x050900
fileDialog.setWindowFlag(Qt::WindowContextHelpButtonHint, false); fileDialog.setWindowFlag(Qt::WindowContextHelpButtonHint, false);
#else
fileDialog.setWindowFlags(fileDialog.windowFlags()^Qt::WindowContextHelpButtonHint);
#endif
fileDialog.setWindowTitle(dialogTitle); fileDialog.setWindowTitle(dialogTitle);
fileDialog.setAcceptMode(fileAcceptMode); fileDialog.setAcceptMode(fileAcceptMode);
fileDialog.setNameFilter(fileFormats); fileDialog.setNameFilter(fileFormats);
@ -531,7 +535,11 @@ int LuaEngineGui::createDialog(lua_State *L_p)
} }
} }
QDialog *dialog = new QDialog(parent); QDialog *dialog = new QDialog(parent);
#if QT_VERSION >= 0x050900
dialog->setWindowFlag(Qt::WindowContextHelpButtonHint, false); dialog->setWindowFlag(Qt::WindowContextHelpButtonHint, false);
#else
dialog->setWindowFlags(dialog->windowFlags()^Qt::WindowContextHelpButtonHint);
#endif
dialog->setObjectName(nameForPointer(dialog)); dialog->setObjectName(nameForPointer(dialog));
dialog->setWindowTitle(windowTitle); dialog->setWindowTitle(windowTitle);
pushPointer(L_p, dialog); pushPointer(L_p, dialog);