mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-02-05 11:24:15 +00:00
Follow project coding style. Issue #2192.
This commit is contained in:
parent
d17f21af45
commit
bed0784a2d
@ -42,23 +42,23 @@
|
|||||||
|
|
||||||
namespace json {
|
namespace json {
|
||||||
|
|
||||||
inline QByteArray toJson(const QVariant& var)
|
inline QByteArray toJson(const QVariant& var)
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
||||||
return QJsonDocument::fromVariant(var).toJson();
|
return QJsonDocument::fromVariant(var).toJson();
|
||||||
#else
|
#else
|
||||||
return QJson::Serializer().serialize(var);
|
return QJson::Serializer().serialize(var);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
inline QVariant fromJson(const QString& json)
|
inline QVariant fromJson(const QString& json)
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
||||||
return QJsonDocument::fromJson(json.toUtf8()).toVariant();
|
return QJsonDocument::fromJson(json.toUtf8()).toVariant();
|
||||||
#else
|
#else
|
||||||
return QJson::Parser().parse(json.toUtf8());
|
return QJson::Parser().parse(json.toUtf8());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user