Make a couple of QgsJsonUtils accessible via QML environment

This commit is contained in:
nirvn 2021-06-10 16:44:22 +07:00 committed by Mathieu Pellerin
parent 25b89e01ed
commit 256dc35a09
2 changed files with 7 additions and 2 deletions

View File

@ -273,6 +273,9 @@ Helper utilities for working with JSON and GeoJSON conversions.
%TypeHeaderCode %TypeHeaderCode
#include "qgsjsonutils.h" #include "qgsjsonutils.h"
%End %End
public:
static const QMetaObject staticMetaObject;
public: public:
static QgsFeatureList stringToFeatureList( const QString &string, const QgsFields &fields = QgsFields(), QTextCodec *encoding = 0 ); static QgsFeatureList stringToFeatureList( const QString &string, const QgsFields &fields = QgsFields(), QTextCodec *encoding = 0 );

View File

@ -290,6 +290,8 @@ class CORE_EXPORT QgsJsonExporter
class CORE_EXPORT QgsJsonUtils class CORE_EXPORT QgsJsonUtils
{ {
Q_GADGET
public: public:
/** /**
@ -317,7 +319,7 @@ class CORE_EXPORT QgsJsonUtils
* \param value value to encode * \param value value to encode
* \returns encoded value * \returns encoded value
*/ */
static QString encodeValue( const QVariant &value ); Q_INVOKABLE static QString encodeValue( const QVariant &value );
/** /**
* Exports all attributes from a QgsFeature as a JSON map type. * Exports all attributes from a QgsFeature as a JSON map type.
@ -351,7 +353,7 @@ class CORE_EXPORT QgsJsonUtils
* the conversion is not possible. * the conversion is not possible.
* \since QGIS 3.0 * \since QGIS 3.0
*/ */
static QVariantList parseArray( const QString &json, QVariant::Type type = QVariant::Invalid ); Q_INVOKABLE static QVariantList parseArray( const QString &json, QVariant::Type type = QVariant::Invalid );
/** /**