mirror of
https://gitlab.com/Syping/luaengineapp.git
synced 2024-12-22 03:45:32 +01:00
Fix Application Launches
This commit is contained in:
parent
ad194edbba
commit
1b6a7cf3c3
3 changed files with 10 additions and 10 deletions
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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<size_t>(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<size_t>(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<size_t>(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<size_t>(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<int>(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<int>(size));
|
||||
const QVariant value = getVariant(L_p, -2);
|
||||
variantMap.insert(key, value);
|
||||
lua_pop(L_p, 2);
|
||||
|
|
Loading…
Reference in a new issue