QGIS API Documentation  3.14.0-Pi (9f7028fd23)
Public Member Functions | List of all members
QgsQuickValueRelationListModel Class Reference

#include <qgsquickvaluerelationlistmodel.h>

Inheritance diagram for QgsQuickValueRelationListModel:
Inheritance graph

Public Member Functions

 QgsQuickValueRelationListModel (QObject *parent=nullptr)
 Constructs an empty list model. More...
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const override
Q_INVOKABLE QVariant keyForRow (int row) const
 Returns key for the given rown number (invalid variant if outside of the valid range) More...
Q_INVOKABLE void populate (const QVariantMap &config, const QgsFeature &formFeature=QgsFeature())
 Populates the model from vector layer's widget configuration. More...
int rowCount (const QModelIndex &) const override
Q_INVOKABLE int rowForKey (const QVariant &key) const
 Returns row number. More...

Detailed Description

List model for combo box in Value Relation widget. The model keeps a list of key-value pairs fetched from a vector layer. "Values" are the human readable descriptions (QString), "keys" are unique identifiers of items (QVariant).

QML Type: ValueRelationListModel
QGIS 3.14

Definition at line 35 of file qgsquickvaluerelationlistmodel.h.

Constructor & Destructor Documentation

◆ QgsQuickValueRelationListModel()

QgsQuickValueRelationListModel::QgsQuickValueRelationListModel ( QObject *  parent = nullptr)

Constructs an empty list model.

Definition at line 21 of file qgsquickvaluerelationlistmodel.cpp.

Member Function Documentation

◆ data()

QVariant QgsQuickValueRelationListModel::data ( const QModelIndex &  index,
int  role = Qt::DisplayRole 
) const

Definition at line 59 of file qgsquickvaluerelationlistmodel.cpp.

◆ keyForRow()

QVariant QgsQuickValueRelationListModel::keyForRow ( int  row) const

Returns key for the given rown number (invalid variant if outside of the valid range)

Definition at line 33 of file qgsquickvaluerelationlistmodel.cpp.

◆ populate()

void QgsQuickValueRelationListModel::populate ( const QVariantMap &  config,
const QgsFeature formFeature = QgsFeature() 

Populates the model from vector layer's widget configuration.

Definition at line 26 of file qgsquickvaluerelationlistmodel.cpp.

◆ rowCount()

int QgsQuickValueRelationListModel::rowCount ( const QModelIndex &  ) const

Definition at line 54 of file qgsquickvaluerelationlistmodel.cpp.

◆ rowForKey()

int QgsQuickValueRelationListModel::rowForKey ( const QVariant &  key) const

Returns row number.

Definition at line 43 of file qgsquickvaluerelationlistmodel.cpp.

The documentation for this class was generated from the following files: