QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
26 if ( a.size() != b.size() )
29 for (
int i = 0; i < a.size(); ++i )
48 return mIdentifierFields.value( 0 );
51 void QgsFeatureFilterModel::requestToReloadCurrentFeature(
QgsFeatureRequest &request )
53 QStringList conditions;
54 for (
int i = 0; i < mIdentifierFields.count(); i++ )
68 QSet<QString> QgsFeatureFilterModel::requestedAttributes()
const
70 return qgis::listToSet( mIdentifierFields );
73 QVariant QgsFeatureFilterModel::entryIdentifier(
const QgsFeatureExpressionValuesGatherer::Entry &entry )
const
75 return entry.featureId;
78 QgsFeatureExpressionValuesGatherer::Entry QgsFeatureFilterModel::createEntry(
const QVariant &identifier )
const
80 const QVariantList constValues = identifier.toList();
83 for (
const QVariant &v : constValues )
84 values << QStringLiteral(
"(%1)" ).arg( v.toString() );
89 bool QgsFeatureFilterModel::compareEntries(
const QgsFeatureExpressionValuesGatherer::Entry &a,
const QgsFeatureExpressionValuesGatherer::Entry &b )
const
94 bool QgsFeatureFilterModel::identifierIsNull(
const QVariant &identifier )
const
96 const QVariantList values = identifier.toList();
97 for (
const QVariant &value : values )
99 if ( !value.isNull() )
107 QVariant QgsFeatureFilterModel::nullIdentifier()
const
109 QVariantList nullValues;
110 for (
int i = 0; i < mIdentifierFields.count(); i++ )
111 nullValues << QVariant( QVariant::Int );
117 return mIdentifierFields;
131 QgsFeatureExpressionValuesGatherer *QgsFeatureFilterModel::createValuesGatherer(
const QgsFeatureRequest &request )
const
140 if ( values.count() != mIdentifierFields.count() )
142 return nullIdentifier().toList();
QStringList identifierFields
A set of fields of sourceLayer that is unique and should be used to identify features.
bool qVariantListCompare(const QVariantList &a, const QVariantList &b)
Container of fields for a vector layer.
QVariantList extraIdentifierValues
The values that identifies the current feature.
void setExtraIdentifierValue(const QVariant &extraIdentifierValue)
Allows specifying one value that does not need to match the filter criteria but will still be availab...
This class is a composition of two QSettings instances:
Provides a list of features based on filter conditions.
void setExtraIdentifierValueUnguarded(const QVariant &identifierValue)
This will set the identifier value to be set in the model even if it doesn't exist currently in the d...
void setIdentifierFields(const QStringList &identifierFields)
The identifier field should be a unique field that can be used to identify individual features.
QVariant mExtraIdentifierValue
The current identifier value.
QgsFeatureFilterModel(QObject *parent=nullptr)
Create a new QgsFeatureFilterModel, optionally specifying a parent.
QgsFeatureRequest & setFilterExpression(const QString &expression)
Set the filter expression.
This class wraps a request for features to a vector layer (or directly its vector data provider).
QgsVectorLayer sourceLayer
void identifierFieldsChanged()
The identifier field should be a unique field that can be used to identify individual features.
QString displayExpression
Q_DECL_DEPRECATED QString identifierField() const
The identifier field should be a unique field that can be used to identify individual features.
static QString createFieldEqualityExpression(const QString &fieldName, const QVariant &value, QVariant::Type fieldType=QVariant::Type::Invalid)
Create an expression allowing to evaluate if a field is equal to a value.
bool qgsVariantEqual(const QVariant &lhs, const QVariant &rhs)
Compares two QVariant values and returns whether they are equal, two NULL values are always treated a...
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
void setFetchLimit(int fetchLimit)
Defines the feature request fetch limit If set to 0, no limit is applied when fetching.
void setFetchGeometry(bool fetchGeometry)
Defines if the geometry will be fetched.
void setExtraIdentifierValueToNull() override
Allows specifying one value that does not need to match the filter criteria but will still be availab...
void setExtraIdentifierValues(const QVariantList &extraIdentifierValues)
Allows specifying one value that does not need to match the filter criteria but will still be availab...