Skip to content

Class QfFeatureListModel

ClassList > QfFeatureListModel

More...

  • #include <qffeaturelistmodel.h>

Inherits the following classes: QAbstractItemModel

Inherited by the following classes: QfFeatureCheckListModelBase

Public Types

Type Name
enum FeatureListRoles

Public Properties

Type Name
property bool addNull
property QfAppExpressionContextScopesGenerator * appExpressionContextScopesGenerator
property QgsFeature currentFormFeature
property QgsVectorLayer * currentLayer
property bool displayGroupName
property QString displayValueField
property QString filterExpression
property QString groupField
property QString keyField
property bool orderByField
property QString orderByFieldName
property bool orderByValue
property QString searchTerm

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 orderByFieldChanged
signal void orderByFieldNameChanged
signal void orderByValueChanged
signal void searchTermChanged

Public Functions

Type Name
QfFeatureListModel (QObject * parent=nullptr)
bool addNull () const
QfAppExpressionContextScopesGenerator * 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 orderByField () const
QString orderByFieldName () 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
QString searchTerm () const
void setAddNull (bool addNull)
void setAppExpressionContextScopesGenerator (QfAppExpressionContextScopesGenerator * 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 setOrderByField (bool orderByField)
void setOrderByFieldName (const QString & orderByFieldName)
void setOrderByValue (bool orderByValue)
void setSearchTerm (const QString & searchTerm)
~QfFeatureListModel ()

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 QfFeatureListModel::FeatureListRoles {
    KeyFieldRole = Qt::UserRole + 1,
    DisplayStringRole,
    GroupFieldRole,
    FeatureIdRole
};

Public Properties Documentation

property addNull [1/2]

bool QfFeatureListModel::addNull;

Set to TRUE if null values are allowed in the list


property appExpressionContextScopesGenerator [1/2]

QfAppExpressionContextScopesGenerator * QfFeatureListModel::appExpressionContextScopesGenerator;

The application expression context scope generator used when filtering by expression


property currentFormFeature [1/2]

QgsFeature QfFeatureListModel::currentFormFeature;

The current form feature, used to evaluate expressions such as current_value('attr1)`


property currentLayer [1/2]

QgsVectorLayer * QfFeatureListModel::currentLayer;

The vector layer to list


property displayGroupName [1/2]

bool QfFeatureListModel::displayGroupName;

Set to TRUE if the group name will be displayed in the list


property displayValueField [1/2]

QString QfFeatureListModel::displayValueField;

The display value field


property filterExpression [1/2]

QString QfFeatureListModel::filterExpression;

Expression to filter features with. Empty string if no filter is applied.


property groupField [1/2]

QString QfFeatureListModel::groupField;

The grouping key field


property keyField [1/2]

QString QfFeatureListModel::keyField;

The primary key field


property orderByField [1/2]

bool QfFeatureListModel::orderByField;

Set to TRUE if features should be ordered by a field


property orderByFieldName [1/2]

QString QfFeatureListModel::orderByFieldName;

Name of field to order features by


property orderByValue [1/2]

bool QfFeatureListModel::orderByValue;

Set to TRUE if features should be ordered by value


property searchTerm [1/2]

QString QfFeatureListModel::searchTerm;

The current search term used to filter items.


Public Signals Documentation

signal addNullChanged

void QfFeatureListModel::addNullChanged;

signal appExpressionContextScopesGeneratorChanged

void QfFeatureListModel::appExpressionContextScopesGeneratorChanged;

signal currentFormFeatureChanged

void QfFeatureListModel::currentFormFeatureChanged;

signal currentLayerChanged

void QfFeatureListModel::currentLayerChanged;

signal displayGroupNameChanged

void QfFeatureListModel::displayGroupNameChanged;

signal displayValueFieldChanged

void QfFeatureListModel::displayValueFieldChanged;

signal filterExpressionChanged

void QfFeatureListModel::filterExpressionChanged;

signal groupFieldChanged

void QfFeatureListModel::groupFieldChanged;

signal keyFieldChanged

void QfFeatureListModel::keyFieldChanged;

signal orderByFieldChanged

void QfFeatureListModel::orderByFieldChanged;

signal orderByFieldNameChanged

void QfFeatureListModel::orderByFieldNameChanged;

signal orderByValueChanged

void QfFeatureListModel::orderByValueChanged;

signal searchTermChanged

void QfFeatureListModel::searchTermChanged;

Public Functions Documentation

function QfFeatureListModel

explicit QfFeatureListModel::QfFeatureListModel (
    QObject * parent=nullptr
) 

function addNull [2/2]

bool QfFeatureListModel::addNull () const

Add a NULL value as the first entry.


function appExpressionContextScopesGenerator [2/2]

QfAppExpressionContextScopesGenerator * QfFeatureListModel::appExpressionContextScopesGenerator () const

Returns the application expression context scope generator used when filtering by expression


function columnCount

virtual int QfFeatureListModel::columnCount (
    const QModelIndex & parent
) override const

function currentFormFeature [2/2]

QgsFeature QfFeatureListModel::currentFormFeature () const

The current form feature, used to evaluate expressions such as current_value('attr1)`


function currentLayer [2/2]

QgsVectorLayer * QfFeatureListModel::currentLayer () const

function data

virtual QVariant QfFeatureListModel::data (
    const QModelIndex & index,
    int role
) override const

function dataFromRowIndex

inline Q_INVOKABLE QVariant QfFeatureListModel::dataFromRowIndex (
    int row,
    int role
) 

function displayGroupName [2/2]

bool QfFeatureListModel::displayGroupName () const

function displayValueField [2/2]

QString QfFeatureListModel::displayValueField () const

function filterExpression [2/2]

QString QfFeatureListModel::filterExpression () const

Expression to filter features with. Empty string if no filter is applied.


function findDisplayValueMatches

Q_INVOKABLE QList< int > QfFeatureListModel::findDisplayValueMatches (
    const QString & filter
) const

Get rows for a given filter string used to match display values.


function findKey

Q_INVOKABLE int QfFeatureListModel::findKey (
    const QVariant & key
) const

Get the row for a given key value.


function getFeatureById

Q_INVOKABLE QgsFeature QfFeatureListModel::getFeatureById (
    QgsFeatureId id
) const

Returns the first feature matching the key id.


function getFeatureFromKeyValue

Q_INVOKABLE QgsFeature QfFeatureListModel::getFeatureFromKeyValue (
    const QVariant & value
) const

Returns the first feature matching the key value.


function groupField [2/2]

QString QfFeatureListModel::groupField () const

function index

virtual QModelIndex QfFeatureListModel::index (
    int row,
    int column,
    const QModelIndex & parent
) override const

function keyField [2/2]

QString QfFeatureListModel::keyField () const

function orderByField [2/2]

bool QfFeatureListModel::orderByField () const

Orders all the values alphabethically by a field


function orderByFieldName [2/2]

QString QfFeatureListModel::orderByFieldName () const

Orders all the values by another field.


function orderByValue [2/2]

bool QfFeatureListModel::orderByValue () const

Orders all the values alphabethically by their displayString.


function parent

virtual QModelIndex QfFeatureListModel::parent (
    const QModelIndex & child
) override const

function roleNames

virtual QHash< int, QByteArray > QfFeatureListModel::roleNames () override const

function rowCount

virtual int QfFeatureListModel::rowCount (
    const QModelIndex & parent=QModelIndex()
) override const

function searchTerm [2/2]

QString QfFeatureListModel::searchTerm () const

Returns the current search term used to filter items.


function setAddNull

void QfFeatureListModel::setAddNull (
    bool addNull
) 

Add a NULL value as the first entry.


function setAppExpressionContextScopesGenerator

void QfFeatureListModel::setAppExpressionContextScopesGenerator (
    QfAppExpressionContextScopesGenerator * generator
) 

Sets the application expression context scope generator used when filtering by expression


function setCurrentFormFeature

void QfFeatureListModel::setCurrentFormFeature (
    const QgsFeature & feature
) 

Sets the current form feature, used to evaluate expressions such as current_value('attr1)`


function setCurrentLayer

void QfFeatureListModel::setCurrentLayer (
    QgsVectorLayer * currentLayer
) 

function setDisplayGroupName

void QfFeatureListModel::setDisplayGroupName (
    bool displayGroupName
) 

function setDisplayValueField

void QfFeatureListModel::setDisplayValueField (
    const QString & displayValueField
) 

function setFilterExpression

void QfFeatureListModel::setFilterExpression (
    const QString & filterExpression
) 

Sets an expression to filter features with. Empty string if no filter is applied.


function setGroupField

void QfFeatureListModel::setGroupField (
    const QString & groupField
) 

function setKeyField

void QfFeatureListModel::setKeyField (
    const QString & keyField
) 

function setOrderByField

void QfFeatureListModel::setOrderByField (
    bool orderByField
) 

Orders all the values alphabethically by a field


function setOrderByFieldName

void QfFeatureListModel::setOrderByFieldName (
    const QString & orderByFieldName
) 

Orders all the values by another field.


function setOrderByValue

void QfFeatureListModel::setOrderByValue (
    bool orderByValue
) 

Orders all the values alphabethically by their displayString.


function setSearchTerm

void QfFeatureListModel::setSearchTerm (
    const QString & searchTerm
) 

Sets the search term for filtering and updates the filter.


function ~QfFeatureListModel

QfFeatureListModel::~QfFeatureListModel () 


The documentation for this class was generated from the following file src/core/qffeaturelistmodel.h