From 1b6a7cf3c3b9aad872f38666d4f0caa7e91e7f84 Mon Sep 17 00:00:00 2001 From: Syping Date: Mon, 9 Aug 2021 15:42:56 +0200 Subject: [PATCH] Fix Application Launches --- src/luaengine/main.cpp | 4 ++-- src/luaenginecli/main.cpp | 4 ++-- src/luaenginecore/luaengine/LuaEngine.cpp | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/luaengine/main.cpp b/src/luaengine/main.cpp index 5897553..b209095 100644 --- a/src/luaengine/main.cpp +++ b/src/luaengine/main.cpp @@ -86,9 +86,9 @@ int main(int argc, char *argv[]) return variant.toInt(); } #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) - else if (variant.typeId() == QMetaType::QString) { + else if (variant.typeId() == QMetaType::QByteArray) { #else - else if (variant.type() == QVariant::String) { + else if (variant.type() == QVariant::ByteArray) { #endif if (variant.toString() == "GuiExecuted" || variant.toString() == "CliExecuted") { return a.exec(); diff --git a/src/luaenginecli/main.cpp b/src/luaenginecli/main.cpp index c862971..12ba7b2 100644 --- a/src/luaenginecli/main.cpp +++ b/src/luaenginecli/main.cpp @@ -72,9 +72,9 @@ int main(int argc, char *argv[]) return variant.toInt(); } #if QT_VERSION >= 0x060000 - else if (variant.typeId() == QMetaType::QString) { + else if (variant.typeId() == QMetaType::QByteArray) { #else - else if (variant.type() == QVariant::String) { + else if (variant.type() == QVariant::ByteArray) { #endif if (variant.toString() == "CliExecuted") { return a.exec(); diff --git a/src/luaenginecore/luaengine/LuaEngine.cpp b/src/luaenginecore/luaengine/LuaEngine.cpp index 9e917eb..fd2972d 100644 --- a/src/luaenginecore/luaengine/LuaEngine.cpp +++ b/src/luaenginecore/luaengine/LuaEngine.cpp @@ -282,11 +282,11 @@ void LuaEngine::pushVariant(lua_State *L_p, const QVariant &variant) } else if (variant.type() == QVariant::ByteArray) { const QByteArray luaBArray = variant.toByteArray(); - lua_pushlstring(L_p, luaBArray.data(), luaBArray.size()); + lua_pushlstring(L_p, luaBArray.data(), static_cast(luaBArray.size())); } else if (variant.type() == QVariant::String) { const QByteArray luaBArray = variant.toString().toUtf8(); - lua_pushlstring(L_p, luaBArray.data(), luaBArray.size()); + lua_pushlstring(L_p, luaBArray.data(), static_cast(luaBArray.size())); } else if (variant.type() == QVariant::StringList) { const QStringList stringList = variant.toStringList(); @@ -295,7 +295,7 @@ void LuaEngine::pushVariant(lua_State *L_p, const QVariant &variant) for (const QString &string : stringList) { lua_pushinteger(L_p, currentId); const QByteArray luaBArray = string.toUtf8(); - lua_pushlstring(L_p, luaBArray.data(), luaBArray.size()); + lua_pushlstring(L_p, luaBArray.data(), static_cast(luaBArray.size())); lua_settable(L_p, -3); currentId++; } @@ -316,7 +316,7 @@ void LuaEngine::pushVariant(lua_State *L_p, const QVariant &variant) lua_createtable(L_p, 0, variantMap.count()); for (auto it = variantMap.constBegin(); it != variantMap.constEnd(); it++) { const QByteArray luaBArray = it.key().toUtf8(); - lua_pushlstring(L_p, luaBArray.data(), luaBArray.size()); + lua_pushlstring(L_p, luaBArray.data(), static_cast(luaBArray.size())); pushVariant(L_p, it.value()); lua_settable(L_p, -3); } @@ -360,7 +360,7 @@ QVariant LuaEngine::getVariant(lua_State *L_p, int index) else if (lua_isstring(L_p, index)) { size_t size; const char* str = lua_tolstring(L_p, index, &size); - return QVariant::fromValue(QByteArray(str, size)); + return QVariant::fromValue(QByteArray(str, static_cast(size))); } else if (lua_istable(L_p, index)) { QVariantMap variantMap; @@ -370,7 +370,7 @@ QVariant LuaEngine::getVariant(lua_State *L_p, int index) lua_pushvalue(L_p, -2); size_t size; const char* str = lua_tolstring(L_p, -1, &size); - const QString key = QString::fromUtf8(str, size); + const QString key = QString::fromUtf8(str, static_cast(size)); const QVariant value = getVariant(L_p, -2); variantMap.insert(key, value); lua_pop(L_p, 2);