16#ifndef QGSFIELDMODEL_H
17#define QGSFIELDMODEL_H
19#include <QAbstractItemModel>
21#include <QItemSelectionModel>
42 Q_PROPERTY(
bool allowExpression READ allowExpression WRITE setAllowExpression )
43 Q_PROPERTY(
bool allowEmptyFieldName READ allowEmptyFieldName WRITE setAllowEmptyFieldName )
51 FieldNameRole = Qt::UserRole + 1,
52 FieldIndexRole = Qt::UserRole + 2,
53 ExpressionRole = Qt::UserRole + 3,
54 IsExpressionRole = Qt::UserRole + 4,
55 ExpressionValidityRole = Qt::UserRole + 5,
56 FieldTypeRole = Qt::UserRole + 6,
57 FieldOriginRole = Qt::UserRole + 7,
58 IsEmptyRole = Qt::UserRole + 8,
59 EditorWidgetType = Qt::UserRole + 9,
60 JoinedFieldIsEditable = Qt::UserRole + 10,
61 FieldIsWidgetEditable = Qt::UserRole + 11,
72 QModelIndex indexFromName(
const QString &fieldName );
79 void setAllowExpression(
bool allowExpression );
92 void setAllowEmptyFieldName(
bool allowEmpty );
105 bool isField(
const QString &expression )
const;
113 void setExpression(
const QString &expression );
120 void removeExpression();
129 QModelIndex index(
int row,
int column,
const QModelIndex &parent = QModelIndex() )
const override;
130 QModelIndex parent(
const QModelIndex &child )
const override;
131 int rowCount(
const QModelIndex &parent = QModelIndex() )
const override;
132 int columnCount(
const QModelIndex &parent )
const override;
133 QVariant data(
const QModelIndex &index,
int role )
const override;
159 void setFields(
const QgsFields &fields );
184 virtual void updateModel();
194 bool mAllowExpression =
false;
195 bool mAllowEmpty =
false;
The QgsFieldModel class is a model to display the list of fields in widgets (optionally associated wi...
FieldRoles
Roles utilized by the model.
bool allowEmptyFieldName() const
Returns true if the model allows the empty field ("not set") choice.
QgsVectorLayer * layer()
Returns the layer associated with the model.
bool allowExpression()
Returns true if the model allows custom expressions to be created and displayed.
QList< QString > mExpression
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 data sets.