1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 09:32:12 +01:00

[QJson] Hack to check for Indent support

There is no library version available in header files, so this is
the only solution to fix building on Debian stable
This commit is contained in:
nowrep 2014-02-08 00:19:22 +01:00
parent a7240e07d1
commit eef8741b4b
2 changed files with 12 additions and 1 deletions

View File

@ -58,6 +58,9 @@ else {
}
}
# Ugly hack to check for Indent support in QJson
system(grep "enum IndentMode" /usr/include/qjson/serializer.h &> /dev/null): DEFINES *= QJSON_HAVE_INDENT
DEFINES *= QT_NO_URL_CAST_FROM_STRING
DEFINES *= QT_USE_QSTRINGBUILDER

View File

@ -45,8 +45,16 @@ QByteArray Json::serialize(const QVariant &variant, bool* ok)
{
#if QT_VERSION < 0x050000
QJson::Serializer serializer;
#ifdef QJSON_HAVE_INDENT
serializer.setIndentMode(QJson::IndentFull);
return serializer.serialize(variant, ok);
#endif
const QByteArray data = serializer.serialize(variant);
if (ok) {
*ok = !data.isNull();
}
return data;
#else
QJsonDocument doc = QJsonDocument::fromVariant(variant);