QGIS API Documentation
3.14.0-Pi (9f7028fd23)
|
Go to the documentation of this file.
22 : QAbstractListModel( parent )
35 if ( row < 0 || row >= mCache.count() )
37 QgsDebugMsg(
"keyForRow: access outside of range " + QString::number( row ) );
40 return mCache[row].key;
45 for (
int i = 0; i < mCache.count(); ++i )
47 if ( mCache[i].key == key )
50 QgsDebugMsg(
"rowForKey: key not found: " + key.toString() );
56 return mCache.count();
61 if ( !index.isValid() )
64 int row = index.row();
65 if ( row < 0 || row >= mCache.count() )
68 if ( role == Qt::DisplayRole )
69 return mCache[row].value;
Q_INVOKABLE void populate(const QVariantMap &config, const QgsFeature &formFeature=QgsFeature())
Populates the model from vector layer's widget configuration.
Q_INVOKABLE QVariant keyForRow(int row) const
Returns key for the given rown number (invalid variant if outside of the valid range)
Q_INVOKABLE int rowForKey(const QVariant &key) const
Returns row number.
QgsQuickValueRelationListModel(QObject *parent=nullptr)
Constructs an empty list model.
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
int rowCount(const QModelIndex &) const override