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:
parent
a7240e07d1
commit
eef8741b4b
|
@ -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_NO_URL_CAST_FROM_STRING
|
||||||
DEFINES *= QT_USE_QSTRINGBUILDER
|
DEFINES *= QT_USE_QSTRINGBUILDER
|
||||||
|
|
||||||
|
|
|
@ -45,8 +45,16 @@ QByteArray Json::serialize(const QVariant &variant, bool* ok)
|
||||||
{
|
{
|
||||||
#if QT_VERSION < 0x050000
|
#if QT_VERSION < 0x050000
|
||||||
QJson::Serializer serializer;
|
QJson::Serializer serializer;
|
||||||
|
#ifdef QJSON_HAVE_INDENT
|
||||||
serializer.setIndentMode(QJson::IndentFull);
|
serializer.setIndentMode(QJson::IndentFull);
|
||||||
return serializer.serialize(variant, ok);
|
#endif
|
||||||
|
const QByteArray data = serializer.serialize(variant);
|
||||||
|
|
||||||
|
if (ok) {
|
||||||
|
*ok = !data.isNull();
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
#else
|
#else
|
||||||
QJsonDocument doc = QJsonDocument::fromVariant(variant);
|
QJsonDocument doc = QJsonDocument::fromVariant(variant);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user