16 #ifndef QGSFIELDMODEL_H
17 #define QGSFIELDMODEL_H
19 #include <QAbstractItemModel>
21 #include <QItemSelectionModel>
24 #include "qgis_core.h"
41 Q_PROPERTY(
bool allowExpression READ allowExpression WRITE setAllowExpression )
42 Q_PROPERTY(
bool allowEmptyFieldName READ allowEmptyFieldName WRITE setAllowEmptyFieldName )
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();
199 bool mAllowExpression =
false;
200 bool mAllowEmpty =
false;
The QgsFieldModel class is a model to display the list of fields in widgets (optionally associated wi...
bool allowEmptyFieldName() const
Returns true if the model allows the empty field ("not set") choice.
QgsVectorLayer * layer()
Returns the layer associated with the model.
CustomRole
Custom model roles.
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.
#define SIP_MONKEYPATCH_SCOPEENUM_UNNEST(OUTSIDE_CLASS, FORMERNAME)
#define SIP_MONKEYPATCH_COMPAT_NAME(FORMERNAME)