QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
List Model holding features of specific layer. More...
#include <qgsquickfeatureslistmodel.h>
Public Types | |
enum | modelRoles { FeatureTitle = Qt::UserRole + 1, FeatureId, Feature, Description, KeyColumn, FoundPair } |
Roles for FeaturesListModel. More... | |
Signals | |
void | featuresCountChanged (int featuresCount) |
featuresCountChanged Signal emitted when features are reloaded or layer is changed More... | |
void | featuresLimitChanged (int featuresLimit) |
Signal emitted when maximum number of features that can be loaded changes. More... | |
void | filterExpressionChanged (QString filterExpression) |
Signal emitted when filter expression has changed. More... | |
Public Member Functions | |
QgsQuickFeaturesListModel (QObject *parent=nullptr) | |
Create features list model. More... | |
~QgsQuickFeaturesListModel () override | |
QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const override |
Q_INVOKABLE QgsQuickFeatureLayerPair | featureLayerPair (const int &featureId) |
Function to get QgsQuickFeatureLayerPair by feature id. More... | |
int | featuresCount () const |
Returns number of features in layer, not number of loaded features. More... | |
int | featuresLimit () const |
Returns maximum amount of features that can be queried from layer. More... | |
QString | filterExpression () const |
Returns filter expression, empty string represents no filter. More... | |
Q_INVOKABLE int | keyFromAttribute (const int role, const QVariant &value) const |
keyFromAttribute finds feature with requested role and value, returns keycolumn More... | |
Q_INVOKABLE void | populateFromLayer (QgsVectorLayer *layer) |
populateFromLayer populates model with features from layer More... | |
Q_ENUM (modelRoles) | |
Q_INVOKABLE void | reloadFeatures () |
reloadFeatures reloads features from current layer More... | |
QHash< int, QByteArray > | roleNames () const override |
int | rowCount (const QModelIndex &parent=QModelIndex()) const override |
Q_INVOKABLE int | rowFromAttribute (const int role, const QVariant &value) const |
rowFromAttribute finds feature with requested role and value, returns its row More... | |
void | setFeatureTitleField (const QString &attribute) |
setFeatureTitleField Sets name of attribute that will be used for FeatureTitle and Qt::DisplayRole More... | |
void | setFilterExpression (const QString &filterExpression) |
setFilterExpression Sets filter expression, upon setting also reloads features from current layer with new filter More... | |
void | setKeyField (const QString &attribute) |
Sets name of attribute used as "key" in value relation. More... | |
Q_INVOKABLE void | setupValueRelation (const QVariantMap &config) |
setupValueRelation populates model with value relation data from config More... | |
Properties | |
int | featuresCount |
Read only property holding true number of features in layer - not only requested features Changing filter expression does not result in changing this number. More... | |
int | featuresLimit |
Property limiting maximum number of features queried from layer Read only property. More... | |
QString | filterExpression |
Filter Expression represents filter used when querying for data in current layer. More... | |
List Model holding features of specific layer.
Model allows searching by any string or number attribute.
Definition at line 35 of file qgsquickfeatureslistmodel.h.
Roles for FeaturesListModel.
Definition at line 60 of file qgsquickfeatureslistmodel.h.
|
explicit |
Create features list model.
Definition at line 20 of file qgsquickfeatureslistmodel.cpp.
|
inlineoverride |
Definition at line 73 of file qgsquickfeatureslistmodel.h.
|
override |
Definition at line 58 of file qgsquickfeatureslistmodel.cpp.
QgsQuickFeatureLayerPair QgsQuickFeaturesListModel::featureLayerPair | ( | const int & | featureId | ) |
Function to get QgsQuickFeatureLayerPair by feature id.
Definition at line 270 of file qgsquickfeatureslistmodel.cpp.
int QgsQuickFeaturesListModel::featuresCount | ( | ) | const |
Returns number of features in layer, not number of loaded features.
Definition at line 208 of file qgsquickfeatureslistmodel.cpp.
|
signal |
featuresCountChanged Signal emitted when features are reloaded or layer is changed
featuresCount | number of features in layer, not number of loaded features |
int QgsQuickFeaturesListModel::featuresLimit | ( | ) | const |
Returns maximum amount of features that can be queried from layer.
Definition at line 238 of file qgsquickfeatureslistmodel.cpp.
|
signal |
Signal emitted when maximum number of features that can be loaded changes.
QString QgsQuickFeaturesListModel::filterExpression | ( | ) | const |
Returns filter expression, empty string represents no filter.
Definition at line 215 of file qgsquickfeatureslistmodel.cpp.
|
signal |
Signal emitted when filter expression has changed.
int QgsQuickFeaturesListModel::keyFromAttribute | ( | const int | role, |
const QVariant & | value | ||
) | const |
keyFromAttribute finds feature with requested role and value, returns keycolumn
role | role to find from modelRoles |
value | value to find |
Definition at line 256 of file qgsquickfeatureslistmodel.cpp.
void QgsQuickFeaturesListModel::populateFromLayer | ( | QgsVectorLayer * | layer | ) |
populateFromLayer populates model with features from layer
layer | to be used |
Definition at line 173 of file qgsquickfeatureslistmodel.cpp.
QgsQuickFeaturesListModel::Q_ENUM | ( | modelRoles | ) |
void QgsQuickFeaturesListModel::reloadFeatures | ( | ) |
reloadFeatures reloads features from current layer
Definition at line 182 of file qgsquickfeatureslistmodel.cpp.
|
override |
Definition at line 196 of file qgsquickfeatureslistmodel.cpp.
|
override |
Definition at line 26 of file qgsquickfeatureslistmodel.cpp.
int QgsQuickFeaturesListModel::rowFromAttribute | ( | const int | role, |
const QVariant & | value | ||
) | const |
rowFromAttribute finds feature with requested role and value, returns its row
role | to find from modelRoles |
value | to find |
Definition at line 243 of file qgsquickfeatureslistmodel.cpp.
void QgsQuickFeaturesListModel::setFeatureTitleField | ( | const QString & | attribute | ) |
setFeatureTitleField Sets name of attribute that will be used for FeatureTitle and Qt::DisplayRole
attribute | Name of attribute to use. If empty, displayExpression will be used. |
Definition at line 228 of file qgsquickfeatureslistmodel.cpp.
void QgsQuickFeaturesListModel::setFilterExpression | ( | const QString & | filterExpression | ) |
setFilterExpression Sets filter expression, upon setting also reloads features from current layer with new filter
filterExpression | QString to set, empty string represents no filter |
Definition at line 220 of file qgsquickfeatureslistmodel.cpp.
void QgsQuickFeaturesListModel::setKeyField | ( | const QString & | attribute | ) |
Sets name of attribute used as "key" in value relation.
Definition at line 233 of file qgsquickfeatureslistmodel.cpp.
void QgsQuickFeaturesListModel::setupValueRelation | ( | const QVariantMap & | config | ) |
setupValueRelation populates model with value relation data from config
config | to be used |
Definition at line 152 of file qgsquickfeatureslistmodel.cpp.
|
read |
Read only property holding true number of features in layer - not only requested features Changing filter expression does not result in changing this number.
Definition at line 1 of file qgsquickfeatureslistmodel.h.
|
read |
Property limiting maximum number of features queried from layer Read only property.
Definition at line 1 of file qgsquickfeatureslistmodel.h.
|
readwrite |
Filter Expression represents filter used when querying for data in current layer.
String and numerical attributes are compared with filterExpression
Definition at line 1 of file qgsquickfeatureslistmodel.h.