Class FeatureListModel
#include <featurelistmodel.h>
Inherits the following classes: QAbstractItemModel
Inherited by the following classes: FeatureCheckListModelBase
Public Types
| Type | Name |
|---|---|
| enum | FeatureListRoles |
Public Properties
| Type | Name |
|---|---|
| property bool | addNull |
| property AppExpressionContextScopesGenerator * | appExpressionContextScopesGenerator |
| property QgsFeature | currentFormFeature |
| property QgsVectorLayer * | currentLayer |
| property bool | displayGroupName |
| property QString | displayValueField |
| property QString | filterExpression |
| property QString | groupField |
| property QString | keyField |
| property bool | orderByValue |
Public Signals
| Type | Name |
|---|---|
| signal void | addNullChanged |
| signal void | appExpressionContextScopesGeneratorChanged |
| signal void | currentFormFeatureChanged |
| signal void | currentLayerChanged |
| signal void | displayGroupNameChanged |
| signal void | displayValueFieldChanged |
| signal void | filterExpressionChanged |
| signal void | groupFieldChanged |
| signal void | keyFieldChanged |
| signal void | orderByValueChanged |
Public Functions
| Type | Name |
|---|---|
| FeatureListModel (QObject * parent=nullptr) |
|
| bool | addNull () const |
| AppExpressionContextScopesGenerator * | appExpressionContextScopesGenerator () const |
| virtual int | columnCount (const QModelIndex & parent) override const |
| QgsFeature | currentFormFeature () const |
| QgsVectorLayer * | currentLayer () const |
| virtual QVariant | data (const QModelIndex & index, int role) override const |
| Q_INVOKABLE QVariant | dataFromRowIndex (int row, int role) |
| bool | displayGroupName () const |
| QString | displayValueField () const |
| QString | filterExpression () const |
| Q_INVOKABLE QList< int > | findDisplayValueMatches (const QString & filter) const |
| Q_INVOKABLE int | findKey (const QVariant & key) const |
| Q_INVOKABLE QgsFeature | getFeatureById (QgsFeatureId id) const |
| Q_INVOKABLE QgsFeature | getFeatureFromKeyValue (const QVariant & value) const |
| QString | groupField () const |
| virtual QModelIndex | index (int row, int column, const QModelIndex & parent) override const |
| QString | keyField () const |
| bool | orderByValue () const |
| virtual QModelIndex | parent (const QModelIndex & child) override const |
| virtual QHash< int, QByteArray > | roleNames () override const |
| virtual int | rowCount (const QModelIndex & parent=QModelIndex()) override const |
| void | setAddNull (bool addNull) |
| void | setAppExpressionContextScopesGenerator (AppExpressionContextScopesGenerator * generator) |
| void | setCurrentFormFeature (const QgsFeature & feature) |
| void | setCurrentLayer (QgsVectorLayer * currentLayer) |
| void | setDisplayGroupName (bool displayGroupName) |
| void | setDisplayValueField (const QString & displayValueField) |
| void | setFilterExpression (const QString & filterExpression) |
| void | setGroupField (const QString & groupField) |
| void | setKeyField (const QString & keyField) |
| void | setOrderByValue (bool orderByValue) |
| ~FeatureListModel () |
Detailed Description
Provides access to a list of features from a layer. For each feature, the display expression is exposed as DisplayRole and a keyField as KeyFieldRole for a unique identifier. If a displayValueField is set it replaces the display expression of the layer.
Public Types Documentation
enum FeatureListRoles
enum FeatureListModel::FeatureListRoles {
KeyFieldRole = Qt::UserRole + 1,
DisplayStringRole,
GroupFieldRole,
FeatureIdRole
};
Public Properties Documentation
property addNull [1/2]
bool FeatureListModel::addNull;
Set to TRUE if null values are allowed in the list
property appExpressionContextScopesGenerator [1/2]
AppExpressionContextScopesGenerator * FeatureListModel::appExpressionContextScopesGenerator;
The application expression context scope generator used when filtering by expression
property currentFormFeature [1/2]
QgsFeature FeatureListModel::currentFormFeature;
The current form feature, used to evaluate expressions such as current_value('attr1)`
property currentLayer [1/2]
QgsVectorLayer * FeatureListModel::currentLayer;
The vector layer to list
property displayGroupName [1/2]
bool FeatureListModel::displayGroupName;
Set to TRUE if the group name will be displayed in the list
property displayValueField [1/2]
QString FeatureListModel::displayValueField;
The display value field
property filterExpression [1/2]
QString FeatureListModel::filterExpression;
Expression to filter features with. Empty string if no filter is applied.
property groupField [1/2]
QString FeatureListModel::groupField;
The grouping key field
property keyField [1/2]
QString FeatureListModel::keyField;
The primary key field
property orderByValue [1/2]
bool FeatureListModel::orderByValue;
Set to TRUE if features should be ordered by value
Public Signals Documentation
signal addNullChanged
void FeatureListModel::addNullChanged;
signal appExpressionContextScopesGeneratorChanged
void FeatureListModel::appExpressionContextScopesGeneratorChanged;
signal currentFormFeatureChanged
void FeatureListModel::currentFormFeatureChanged;
signal currentLayerChanged
void FeatureListModel::currentLayerChanged;
signal displayGroupNameChanged
void FeatureListModel::displayGroupNameChanged;
signal displayValueFieldChanged
void FeatureListModel::displayValueFieldChanged;
signal filterExpressionChanged
void FeatureListModel::filterExpressionChanged;
signal groupFieldChanged
void FeatureListModel::groupFieldChanged;
signal keyFieldChanged
void FeatureListModel::keyFieldChanged;
signal orderByValueChanged
void FeatureListModel::orderByValueChanged;
Public Functions Documentation
function FeatureListModel
explicit FeatureListModel::FeatureListModel (
QObject * parent=nullptr
)
function addNull [2/2]
bool FeatureListModel::addNull () const
Add a NULL value as the first entry.
function appExpressionContextScopesGenerator [2/2]
AppExpressionContextScopesGenerator * FeatureListModel::appExpressionContextScopesGenerator () const
Returns the application expression context scope generator used when filtering by expression
function columnCount
virtual int FeatureListModel::columnCount (
const QModelIndex & parent
) override const
function currentFormFeature [2/2]
QgsFeature FeatureListModel::currentFormFeature () const
The current form feature, used to evaluate expressions such as current_value('attr1)`
function currentLayer [2/2]
QgsVectorLayer * FeatureListModel::currentLayer () const
function data
virtual QVariant FeatureListModel::data (
const QModelIndex & index,
int role
) override const
function dataFromRowIndex
inline Q_INVOKABLE QVariant FeatureListModel::dataFromRowIndex (
int row,
int role
)
function displayGroupName [2/2]
bool FeatureListModel::displayGroupName () const
function displayValueField [2/2]
QString FeatureListModel::displayValueField () const
function filterExpression [2/2]
QString FeatureListModel::filterExpression () const
Expression to filter features with. Empty string if no filter is applied.
function findDisplayValueMatches
Q_INVOKABLE QList< int > FeatureListModel::findDisplayValueMatches (
const QString & filter
) const
Get rows for a given filter string used to match display values.
function findKey
Q_INVOKABLE int FeatureListModel::findKey (
const QVariant & key
) const
Get the row for a given key value.
function getFeatureById
Q_INVOKABLE QgsFeature FeatureListModel::getFeatureById (
QgsFeatureId id
) const
Returns the first feature matching the key id.
function getFeatureFromKeyValue
Q_INVOKABLE QgsFeature FeatureListModel::getFeatureFromKeyValue (
const QVariant & value
) const
Returns the first feature matching the key value.
function groupField [2/2]
QString FeatureListModel::groupField () const
function index
virtual QModelIndex FeatureListModel::index (
int row,
int column,
const QModelIndex & parent
) override const
function keyField [2/2]
QString FeatureListModel::keyField () const
function orderByValue [2/2]
bool FeatureListModel::orderByValue () const
Orders all the values alphabethically by their displayString.
function parent
virtual QModelIndex FeatureListModel::parent (
const QModelIndex & child
) override const
function roleNames
virtual QHash< int, QByteArray > FeatureListModel::roleNames () override const
function rowCount
virtual int FeatureListModel::rowCount (
const QModelIndex & parent=QModelIndex()
) override const
function setAddNull
void FeatureListModel::setAddNull (
bool addNull
)
Add a NULL value as the first entry.
function setAppExpressionContextScopesGenerator
void FeatureListModel::setAppExpressionContextScopesGenerator (
AppExpressionContextScopesGenerator * generator
)
Sets the application expression context scope generator used when filtering by expression
function setCurrentFormFeature
void FeatureListModel::setCurrentFormFeature (
const QgsFeature & feature
)
Sets the current form feature, used to evaluate expressions such as current_value('attr1)`
function setCurrentLayer
void FeatureListModel::setCurrentLayer (
QgsVectorLayer * currentLayer
)
function setDisplayGroupName
void FeatureListModel::setDisplayGroupName (
bool displayGroupName
)
function setDisplayValueField
void FeatureListModel::setDisplayValueField (
const QString & displayValueField
)
function setFilterExpression
void FeatureListModel::setFilterExpression (
const QString & filterExpression
)
Sets an expression to filter features with. Empty string if no filter is applied.
function setGroupField
void FeatureListModel::setGroupField (
const QString & groupField
)
function setKeyField
void FeatureListModel::setKeyField (
const QString & keyField
)
function setOrderByValue
void FeatureListModel::setOrderByValue (
bool orderByValue
)
Orders all the values alphabethically by their displayString.
function ~FeatureListModel
FeatureListModel::~FeatureListModel ()
The documentation for this class was generated from the following file src/core/featurelistmodel.h