mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-20 07:27:22 -06:00
Use simpler DEFINE for detecting Qt5 so moc will work too.
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
#define JSONUTILS_H
|
||||
|
||||
#include <QVariant>
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
||||
#ifdef QBT_USES_QT5
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonArray>
|
||||
@@ -49,7 +49,7 @@ namespace json {
|
||||
|
||||
inline QByteArray toJson(const QVariant& var)
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
||||
#ifdef QBT_USES_QT5
|
||||
return QJsonDocument::fromVariant(var).toJson(QJsonDocument::Compact);
|
||||
#else
|
||||
QJson::Serializer serializer;
|
||||
@@ -60,7 +60,7 @@ namespace json {
|
||||
|
||||
inline QVariant fromJson(const QString& json)
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
||||
#ifdef QBT_USES_QT5
|
||||
return QJsonDocument::fromJson(json.toUtf8()).toVariant();
|
||||
#else
|
||||
return QJson::Parser().parse(json.toUtf8());
|
||||
|
||||
Reference in New Issue
Block a user