mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-16 02:03:07 -07:00
Follow project coding style. Issue #2192.
This commit is contained in:
parent
d17f21af45
commit
bed0784a2d
1 changed files with 10 additions and 10 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue