Skip to content

Class QfFeatureCheckListModel

ClassList > QfFeatureCheckListModel

More...

  • #include <qffeaturechecklistmodel.h>

Inherits the following classes: QSortFilterProxyModel

Public Properties

Type Name
property bool addNull
Set to TRUE if null values are allowed in the list.
property bool allowMulti
The attribute field to have information about type (JSON/HSTORE) etc.
property QfAppExpressionContextScopesGenerator * appExpressionContextScopesGenerator
The application expression context scope generator used when filtering by expression.
property QgsField attributeField
The attribute field to have information about type (JSON/HSTORE) etc.
property QVariant attributeValue
The attribute value to generate checklist.
property QgsFeature currentFormFeature
The current form feature, used to evaluate expressions such as current_value('attr1 )`.
property QgsVectorLayer * currentLayer
The vector layer to list.
property bool displayGroupName
Set to TRUE if the group name will be displayed in the list.
property QString displayValueField
The display value field.
property QString filterExpression
Expression to filter features with. Empty string if no filter is applied.
property QString groupField
The grouping key field.
property QString keyField
The primary key field.
property bool orderByField
Set to TRUE if features should be ordered by a field.
property QString orderByFieldName
Field to sort features over.
property bool orderByValue
Set to TRUE if features should be ordered by value.
property QString searchTerm
The current search term used to filter items.
property bool sortCheckedFirst
The sorting method.

Public Signals

Type Name
signal void addNullChanged
signal void allowMultiChanged
signal void appExpressionContextScopesGeneratorChanged
signal void attributeFieldChanged
signal void attributeValueChanged
signal void currentFormFeatureChanged
signal void currentLayerChanged
signal void displayGroupNameChanged
signal void displayValueFieldChanged
signal void filterExpressionChanged
signal void groupFieldChanged
signal void keyFieldChanged
signal void listUpdated
signal void orderByFieldChanged
signal void orderByFieldNameChanged
signal void orderByValueChanged
signal void searchTermChanged
signal void sortCheckedFirstChanged

Public Functions

Type Name
QfFeatureCheckListModel (QObject * parent=nullptr)
bool addNull () const
bool allowMulti () const
QfAppExpressionContextScopesGenerator * appExpressionContextScopesGenerator () const
QgsField attributeField () const
QVariant attributeValue () const
QgsFeature currentFormFeature () const
QgsVectorLayer * currentLayer () 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
QString keyField () const
bool orderByField () const
QString orderByFieldName () const
bool orderByValue () const
Q_INVOKABLE int rowCount (const QModelIndex & parent=QModelIndex()) override const
QString searchTerm () const
void setAddNull (bool addNull)
void setAllowMulti (bool allowMulti)
void setAppExpressionContextScopesGenerator (QfAppExpressionContextScopesGenerator * generator)
void setAttributeField (const QgsField & field)
void setAttributeValue (const QVariant & attributeValue)
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)
void setSortCheckedFirst (bool enabled)
bool sortCheckedFirst () const
Q_INVOKABLE void toggleCheckAll (bool toggleChecked=true)

Protected Functions

Type Name
bool filterAcceptsRow (int sourceRow, const QModelIndex & sourceParent) override const
bool lessThan (const QModelIndex & left, const QModelIndex & right) override const

Detailed Description

A proxy model for filtering and sorting feature checklist items.

This model enhances a source model (typically a QfFeatureCheckListModel) by allowing: * Text-based filtering using a search term. * Optional sorting that prioritizes checked items. * Fuzzy and prefix-based matching for search refinement.

Used in UI contexts where users interact with large lists of features and need to quickly find and sort items by name or selection state.

Public Properties Documentation

property addNull [1/2]

Set to TRUE if null values are allowed in the list.

bool QfFeatureCheckListModel::addNull;


property allowMulti [1/2]

The attribute field to have information about type (JSON/HSTORE) etc.

bool QfFeatureCheckListModel::allowMulti;


property appExpressionContextScopesGenerator [1/2]

The application expression context scope generator used when filtering by expression.

QfAppExpressionContextScopesGenerator * QfFeatureCheckListModel::appExpressionContextScopesGenerator;


property attributeField [1/2]

The attribute field to have information about type (JSON/HSTORE) etc.

QgsField QfFeatureCheckListModel::attributeField;


property attributeValue [1/2]

The attribute value to generate checklist.

QVariant QfFeatureCheckListModel::attributeValue;


property currentFormFeature [1/2]

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

QgsFeature QfFeatureCheckListModel::currentFormFeature;


property currentLayer [1/2]

The vector layer to list.

QgsVectorLayer * QfFeatureCheckListModel::currentLayer;


property displayGroupName [1/2]

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

bool QfFeatureCheckListModel::displayGroupName;


property displayValueField [1/2]

The display value field.

QString QfFeatureCheckListModel::displayValueField;


property filterExpression [1/2]

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

QString QfFeatureCheckListModel::filterExpression;


property groupField [1/2]

The grouping key field.

QString QfFeatureCheckListModel::groupField;


property keyField [1/2]

The primary key field.

QString QfFeatureCheckListModel::keyField;


property orderByField [1/2]

Set to TRUE if features should be ordered by a field.

bool QfFeatureCheckListModel::orderByField;


property orderByFieldName [1/2]

Field to sort features over.

QString QfFeatureCheckListModel::orderByFieldName;


property orderByValue [1/2]

Set to TRUE if features should be ordered by value.

bool QfFeatureCheckListModel::orderByValue;


property searchTerm [1/2]

The current search term used to filter items.

QString QfFeatureCheckListModel::searchTerm;


property sortCheckedFirst [1/2]

The sorting method.

bool QfFeatureCheckListModel::sortCheckedFirst;


Public Signals Documentation

signal addNullChanged

void QfFeatureCheckListModel::addNullChanged;

signal allowMultiChanged

void QfFeatureCheckListModel::allowMultiChanged;

signal appExpressionContextScopesGeneratorChanged

void QfFeatureCheckListModel::appExpressionContextScopesGeneratorChanged;

signal attributeFieldChanged

void QfFeatureCheckListModel::attributeFieldChanged;

signal attributeValueChanged

void QfFeatureCheckListModel::attributeValueChanged;

signal currentFormFeatureChanged

void QfFeatureCheckListModel::currentFormFeatureChanged;

signal currentLayerChanged

void QfFeatureCheckListModel::currentLayerChanged;

signal displayGroupNameChanged

void QfFeatureCheckListModel::displayGroupNameChanged;

signal displayValueFieldChanged

void QfFeatureCheckListModel::displayValueFieldChanged;

signal filterExpressionChanged

void QfFeatureCheckListModel::filterExpressionChanged;

signal groupFieldChanged

void QfFeatureCheckListModel::groupFieldChanged;

signal keyFieldChanged

void QfFeatureCheckListModel::keyFieldChanged;

signal listUpdated

void QfFeatureCheckListModel::listUpdated;

signal orderByFieldChanged

void QfFeatureCheckListModel::orderByFieldChanged;

signal orderByFieldNameChanged

void QfFeatureCheckListModel::orderByFieldNameChanged;

signal orderByValueChanged

void QfFeatureCheckListModel::orderByValueChanged;

signal searchTermChanged

void QfFeatureCheckListModel::searchTermChanged;

signal sortCheckedFirstChanged

void QfFeatureCheckListModel::sortCheckedFirstChanged;

Public Functions Documentation

function QfFeatureCheckListModel

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

function addNull [2/2]

bool QfFeatureCheckListModel::addNull () const

Add a NULL value as the first entry.


function allowMulti [2/2]

bool QfFeatureCheckListModel::allowMulti () const

Whether multiple selected items are allowed


function appExpressionContextScopesGenerator [2/2]

QfAppExpressionContextScopesGenerator * QfFeatureCheckListModel::appExpressionContextScopesGenerator () const

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


function attributeField [2/2]

QgsField QfFeatureCheckListModel::attributeField () const

the current attribute field


function attributeValue [2/2]

QVariant QfFeatureCheckListModel::attributeValue () const

the attribute value. A QVariantList or an hstore formatted string, depending on the field type.


function currentFormFeature [2/2]

QgsFeature QfFeatureCheckListModel::currentFormFeature () const

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


function currentLayer [2/2]

QgsVectorLayer * QfFeatureCheckListModel::currentLayer () const

function dataFromRowIndex

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

function displayGroupName [2/2]

bool QfFeatureCheckListModel::displayGroupName () const

function displayValueField [2/2]

QString QfFeatureCheckListModel::displayValueField () const

function filterExpression [2/2]

QString QfFeatureCheckListModel::filterExpression () const

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


function findDisplayValueMatches

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

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


function findKey

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

Get the row for a given key value.


function getFeatureById

Q_INVOKABLE QgsFeature QfFeatureCheckListModel::getFeatureById (
    QgsFeatureId id
) const

Returns the first feature matching the feature id.


function getFeatureFromKeyValue

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

Returns the first feature matching the key value.


function groupField [2/2]

QString QfFeatureCheckListModel::groupField () const

function keyField [2/2]

QString QfFeatureCheckListModel::keyField () const

function orderByField [2/2]

bool QfFeatureCheckListModel::orderByField () const

Orders all the values by a field.


function orderByFieldName [2/2]

QString QfFeatureCheckListModel::orderByFieldName () const

Orders all the values by a field.


function orderByValue [2/2]

bool QfFeatureCheckListModel::orderByValue () const

Orders all the values alphabethically by their displayString.


function rowCount

Q_INVOKABLE int QfFeatureCheckListModel::rowCount (
    const QModelIndex & parent=QModelIndex()
) override const

function searchTerm [2/2]

QString QfFeatureCheckListModel::searchTerm () const

Returns the current search term used to filter items.


function setAddNull

void QfFeatureCheckListModel::setAddNull (
    bool addNull
) 

Add a NULL value as the first entry.


function setAllowMulti

void QfFeatureCheckListModel::setAllowMulti (
    bool allowMulti
) 

Sets whether multiple selected items are allowed


function setAppExpressionContextScopesGenerator

void QfFeatureCheckListModel::setAppExpressionContextScopesGenerator (
    QfAppExpressionContextScopesGenerator * generator
) 

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


function setAttributeField

void QfFeatureCheckListModel::setAttributeField (
    const QgsField & field
) 

the current attribute field


function setAttributeValue

void QfFeatureCheckListModel::setAttributeValue (
    const QVariant & attributeValue
) 

the attribute value. A QVariantList or an hstore formatted string, depending on the field type.


function setCurrentFormFeature

void QfFeatureCheckListModel::setCurrentFormFeature (
    const QgsFeature & feature
) 

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


function setCurrentLayer

void QfFeatureCheckListModel::setCurrentLayer (
    QgsVectorLayer * currentLayer
) 

function setDisplayGroupName

void QfFeatureCheckListModel::setDisplayGroupName (
    bool displayGroupName
) 

function setDisplayValueField

void QfFeatureCheckListModel::setDisplayValueField (
    const QString & displayValueField
) 

function setFilterExpression

void QfFeatureCheckListModel::setFilterExpression (
    const QString & filterExpression
) 

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


function setGroupField

void QfFeatureCheckListModel::setGroupField (
    const QString & groupField
) 

function setKeyField

void QfFeatureCheckListModel::setKeyField (
    const QString & keyField
) 

function setOrderByField

void QfFeatureCheckListModel::setOrderByField (
    bool orderByField
) 

Orders all the values by a field.


function setOrderByFieldName

void QfFeatureCheckListModel::setOrderByFieldName (
    const QString & orderByFieldName
) 

Orders all the values by a field.


function setOrderByValue

void QfFeatureCheckListModel::setOrderByValue (
    bool orderByValue
) 

Orders all the values alphabethically by their displayString.


function setSearchTerm

void QfFeatureCheckListModel::setSearchTerm (
    const QString & searchTerm
) 

Sets the search term for filtering and updates the filter.


function setSortCheckedFirst

void QfFeatureCheckListModel::setSortCheckedFirst (
    bool enabled
) 

Enables or disables sorting checked items first.


function sortCheckedFirst [2/2]

bool QfFeatureCheckListModel::sortCheckedFirst () const

Returns whether checked items are sorted to the top.


function toggleCheckAll

Q_INVOKABLE void QfFeatureCheckListModel::toggleCheckAll (
    bool toggleChecked=true
) 

Sets all element to either checked or unchecked state, depending on toggleChecked


Protected Functions Documentation

function filterAcceptsRow

bool QfFeatureCheckListModel::filterAcceptsRow (
    int sourceRow,
    const QModelIndex & sourceParent
) override const

function lessThan

bool QfFeatureCheckListModel::lessThan (
    const QModelIndex & left,
    const QModelIndex & right
) override const


The documentation for this class was generated from the following file src/gui/qffeaturechecklistmodel.h