16 #ifndef QGSQUICKFEATURESMODEL_H
17 #define QGSQUICKFEATURESMODEL_H
19 #include <QAbstractListModel>
43 Q_PROPERTY(
int featuresCount READ featuresCount NOTIFY featuresCountChanged )
49 Q_PROPERTY( QString searchExpression READ searchExpression WRITE setSearchExpression NOTIFY searchExpressionChanged )
55 Q_PROPERTY(
int featuresLimit READ featuresLimit NOTIFY featuresLimitChanged )
61 Q_PROPERTY(
QgsFeature currentFeature READ currentFeature WRITE setCurrentFeature NOTIFY currentFeatureChanged )
68 FeatureTitle = Qt::UserRole + 1,
84 int rowCount(
const QModelIndex &parent = QModelIndex() )
const override;
85 QVariant data(
const QModelIndex &index,
int role = Qt::DisplayRole )
const override;
86 QHash<int, QByteArray> roleNames()
const override;
92 Q_INVOKABLE
void setupValueRelation(
const QVariantMap &config );
103 Q_INVOKABLE
void reloadFeatures();
112 Q_INVOKABLE
int rowFromAttribute(
const int role,
const QVariant &value )
const;
122 Q_INVOKABLE QVariant attributeFromValue(
const int role,
const QVariant &value,
const int requestedRole )
const;
131 Q_INVOKABLE QVariant convertMultivalueFormat(
const QVariant &multivalue,
const int requestedRole = Qt::DisplayRole );
134 int featuresLimit()
const;
136 int featuresCount()
const;
138 QString searchExpression()
const;
144 void setSearchExpression(
const QString &searchExpression );
150 void setFeatureTitleField(
const QString &attribute );
153 void setKeyField(
const QString &attribute );
159 void setFilterExpression(
const QString &filterExpression );
199 QString buildSearchExpression();
212 const int FEATURES_LIMIT = 10000;
215 QString mSearchExpression;
218 QString mFilterExpression;
230 QString mFeatureTitleField;
This class wraps a request for features to a vector layer (or directly its vector data provider).
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Pair of QgsFeature and QgsVectorLayer.
List Model holding features of specific layer.
~QgsQuickFeaturesListModel() override
void currentFeatureChanged(QgsFeature feature)
Signal emitted when current feature has changed.
void featuresLimitChanged(int featuresLimit)
Signal emitted when maximum number of features that can be loaded changes.
void featuresCountChanged(int featuresCount)
featuresCountChanged Signal emitted when features are reloaded or layer is changed
modelRoles
Roles for FeaturesListModel.
@ KeyColumn
secondary text in list view
void searchExpressionChanged(QString searchExpression)
Signal emitted when search expression has changed.
Represents a vector layer which manages a vector based data sets.
QList< QgsQuickFeatureLayerPair > QgsQuickFeatureLayerPairs