mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-16 02:03:07 -07:00
Use simpler DEFINE for detecting Qt5 so moc will work too.
This commit is contained in:
parent
623ab03492
commit
17ac4b90be
28 changed files with 71 additions and 70 deletions
|
@ -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());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue