45 if ( field.
type() == QMetaType::Type::QVariantMap && ( field.
typeName().compare( QStringLiteral(
"JSON" ), Qt::CaseSensitivity::CaseInsensitive ) == 0 || field.
subType() == QMetaType::Type::QString ) )
48 const int MAX_FEATURE_LIMIT { 20 };
57 while ( featureIt.nextFeature( f ) )
60 if ( featureCount > MAX_FEATURE_LIMIT )
65 const QVariant value( f.
attribute( fieldIdx ) );
66 if ( ! value.isNull() )
68 switch ( value.type() )
70 case QVariant::Type::List:
75 case QVariant::Type::String:
77 const QJsonDocument doc = QJsonDocument::fromJson( value.toString().toUtf8() );
91 return ( field.
type() == QMetaType::Type::QVariantList || field.
type() == QMetaType::Type::QStringList || field.
type() == QMetaType::Type::QVariantMap ) && field.
subType() != QMetaType::Type::UnknownType ? 20 : 0;
@ NoGeometry
Geometry is not required. It may still be returned if e.g. required for a filter condition.
Wrapper for iterator of features from vector data provider or vector layer.
This class wraps a request for features to a vector layer (or directly its vector data provider).
QgsFeatureRequest & setFlags(Qgis::FeatureRequestFlags flags)
Sets flags that affect how features will be fetched.
QgsFeatureRequest & setLimit(long long limit)
Set the maximum number of features to request.
QgsFeatureRequest & setSubsetOfAttributes(const QgsAttributeList &attrs)
Set a subset of attributes that will be fetched.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Q_INVOKABLE QVariant attribute(const QString &name) const
Lookup attribute value by attribute name.
Encapsulate a field in an attribute table or data source.
QString typeName() const
Gets the field type.
QMetaType::Type subType() const
If the field is a collection, gets its element's type.
QgsField field(int fieldIdx) const
Returns the field at particular index (must be in range 0..N-1).
A configuration dialog for the List Widget class.
Represents a vector layer which manages a vector based data sets.
QgsFeatureIterator getFeatures(const QgsFeatureRequest &request=QgsFeatureRequest()) const FINAL
Queries the layer for features specified in request.