get QStrings

This commit is contained in:
mrbesen 2022-07-03 19:05:22 +02:00
parent d918a936f4
commit 1cc36ae0ee
Signed by untrusted user: MrBesen
GPG Key ID: 596B2350DCD67504
2 changed files with 8 additions and 0 deletions

View File

@ -21,6 +21,9 @@ std::string convert(const QJsonValue& val);
template<>
bool convert(const QJsonValue& val);
template<>
QString convert(const QJsonValue& val);
template<typename T>
T getValue(const QJsonObject& obj, const char* key, const T& def = {}) {
auto it = obj.constFind(key);

View File

@ -19,6 +19,11 @@ std::string convert(const QJsonValue& val) {
return val.toString().toStdString();
}
template<>
QString convert(const QJsonValue& val) {
return val.toString();
}
template<>
bool convert(const QJsonValue& val) {
if(val.isString())