16#ifndef QGSFIELDMODEL_H
17#define QGSFIELDMODEL_H
23#include <QAbstractItemModel>
25#include <QItemSelectionModel>
64 EditorWidgetType = Qt::UserRole + 9,
65 JoinedFieldIsEditable = Qt::UserRole + 10,
66 FieldIsWidgetEditable = Qt::UserRole + 11,
79 QModelIndex indexFromName(
const QString &fieldName );
86 void setAllowExpression(
bool allowExpression );
98 void setAllowEmptyFieldName(
bool allowEmpty );
110 bool isField(
const QString &expression )
const;
118 void setExpression(
const QString &expression );
125 void removeExpression();
134 QModelIndex index(
int row,
int column,
const QModelIndex &parent = QModelIndex() )
const override;
135 QModelIndex parent(
const QModelIndex &child )
const override;
136 int rowCount(
const QModelIndex &parent = QModelIndex() )
const override;
137 int columnCount(
const QModelIndex &parent )
const override;
138 QVariant data(
const QModelIndex &index,
int role )
const override;
144 static QString fieldToolTip(
const QgsField &field );
163 void setFields(
const QgsFields &fields );
188 virtual void updateModel();
A model which displays the list of fields in widgets (optionally associated with a vector layer).
bool allowEmptyFieldName() const
Returns true if the model allows the empty field ("not set") choice.
void setAllowExpression(bool allowExpression)
Sets whether custom expressions are accepted and displayed in the model.
CustomRole
Custom model roles.
void setLayer(QgsVectorLayer *layer)
Set the layer from which fields are displayed.
QgsVectorLayer * layer()
Returns the layer associated with the model.
QgsFieldModel(QObject *parent=nullptr)
Constructor for QgsFieldModel - creates a model to display the fields of a given layer.
bool allowExpression() const
Returns true if the model allows custom expressions to be created and displayed.
QList< QString > mExpression
void setAllowEmptyFieldName(bool allowEmpty)
Sets whether an optional empty field ("not set") option is present in the model.
Encapsulate a field in an attribute table or data source.
Container of fields for a vector layer.
Represents a vector layer which manages a vector based dataset.
#define SIP_MONKEYPATCH_SCOPEENUM_UNNEST(OUTSIDE_CLASS, FORMERNAME)
#define SIP_MONKEYPATCH_COMPAT_NAME(FORMERNAME)