diff --git a/src/luaengine/main.cpp b/src/luaengine/main.cpp index 4f64aa0..5897553 100644 --- a/src/luaengine/main.cpp +++ b/src/luaengine/main.cpp @@ -26,23 +26,23 @@ int main(int argc, char *argv[]) { -#if QT_VERSION <= QT_VERSION_CHECK(6, 0, 0) +#if QT_VERSION >= 0x060000 QApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true); QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true); #endif QApplication a(argc, argv); #ifdef Q_OS_WIN -#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) - if (QSysInfo::windowsVersion() >= 0x0080) - { +#if QT_VERSION >= 0x050400 + if (QSysInfo::windowsVersion() >= 0x0080) { a.setFont(QApplication::font("QMenu")); } #endif #endif QVariantList arguments; - for (const QString &argument : a.arguments()) { + const QStringList appArgs = a.arguments(); + for (const QString &argument : appArgs) { arguments << QVariant::fromValue(argument); } @@ -52,7 +52,11 @@ int main(int argc, char *argv[]) QVariant scriptPath = arguments.first(); QFile luaScript(scriptPath.toString()); if (!luaScript.open(QIODevice::ReadOnly)) { +#if QT_VERSION >= 0x050F00 QTextStream(stderr) << "Error: Failed to open \"" << arguments.first().toString() << "\"." << Qt::endl; +#else + QTextStream(stderr) << "Error: Failed to open \"" << arguments.first().toString() << "\"." << endl; +#endif return 1; } diff --git a/src/luaenginecli/main.cpp b/src/luaenginecli/main.cpp index 4c88a13..c862971 100644 --- a/src/luaenginecli/main.cpp +++ b/src/luaenginecli/main.cpp @@ -27,7 +27,8 @@ int main(int argc, char *argv[]) QCoreApplication a(argc, argv); QVariantList arguments; - for (const QString &argument : a.arguments()) { + const QStringList appArgs = a.arguments(); + for (const QString &argument : appArgs) { arguments << QVariant::fromValue(argument); } @@ -37,7 +38,11 @@ int main(int argc, char *argv[]) QVariant scriptPath = arguments.first(); QFile luaScript(scriptPath.toString()); if (!luaScript.open(QIODevice::ReadOnly)) { +#if QT_VERSION >= 0x050F00 QTextStream(stderr) << "Error: Failed to open \"" << arguments.first().toString() << "\"." << Qt::endl; +#else + QTextStream(stderr) << "Error: Failed to open \"" << arguments.first().toString() << "\"." << endl; +#endif return 1; } @@ -59,14 +64,14 @@ int main(int argc, char *argv[]) if (luaEngine.executeLuaFunction("main", arguments, true)) { QVariant variant = luaEngine.returnVariant(); -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +#if QT_VERSION >= 0x060000 if (variant.typeId() == QMetaType::Int || variant.typeId() == QMetaType::LongLong) { #else if (variant.type() == QVariant::Int || variant.type() == QVariant::LongLong) { #endif return variant.toInt(); } -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +#if QT_VERSION >= 0x060000 else if (variant.typeId() == QMetaType::QString) { #else else if (variant.type() == QVariant::String) { diff --git a/src/luaengineos/luaengine/LuaEngineOS.cpp b/src/luaengineos/luaengine/LuaEngineOS.cpp index 2ca5b7b..7a7466e 100644 --- a/src/luaengineos/luaengine/LuaEngineOS.cpp +++ b/src/luaengineos/luaengine/LuaEngineOS.cpp @@ -71,7 +71,11 @@ int LuaEngineOS::executeProcess(lua_State *L_p) } } else { +#if QT_VERSION >= 0x050F00 + processReturn = system(getVariant(L_p, 1).toString().toUtf8().constData()); +#else processReturn = QProcess::execute(getVariant(L_p, 1).toString()); +#endif } if (runInBackground && !processSuccessed) { processReturn = -2;