16#ifndef QGSFIELDMODEL_H
17#define QGSFIELDMODEL_H
23#include <QAbstractItemModel>
25#include <QItemSelectionModel>
65 EditorWidgetType = Qt::UserRole + 9,
66 JoinedFieldIsEditable = Qt::UserRole + 10,
67 FieldIsWidgetEditable = Qt::UserRole + 11,
80 QModelIndex indexFromName(
const QString &fieldName );
87 void setAllowExpression(
bool allowExpression );
99 void setAllowEmptyFieldName(
bool allowEmpty );
111 bool isField(
const QString &expression )
const;
119 void setExpression(
const QString &expression );
126 void removeExpression();
135 QModelIndex index(
int row,
int column,
const QModelIndex &parent = QModelIndex() )
const override;
136 QModelIndex parent(
const QModelIndex &child )
const override;
137 int rowCount(
const QModelIndex &parent = QModelIndex() )
const override;
138 int columnCount(
const QModelIndex &parent )
const override;
139 QVariant data(
const QModelIndex &index,
int role )
const override;
145 static QString fieldToolTip(
const QgsField &field );
164 void setFields(
const QgsFields &fields );
189 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)