Avoid back and forth string conversions

This commit is contained in:
Chocobo1 2019-08-04 16:44:12 +08:00
parent 6cc7c700b8
commit a3ca277eaf
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C

View File

@ -45,8 +45,8 @@ QVariant APIController::run(const QString &action, const StringMap &params, cons
m_params = params;
m_data = data;
const QString methodName {action + QLatin1String("Action")};
if (!QMetaObject::invokeMethod(this, methodName.toLatin1().constData()))
const QByteArray methodName = action.toLatin1() + "Action";
if (!QMetaObject::invokeMethod(this, methodName.constData()))
throw APIError(APIErrorType::NotFound);
return m_result;