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 )
50 FieldNameRole = Qt::UserRole + 1,
51 FieldIndexRole = Qt::UserRole + 2,
52 ExpressionRole = Qt::UserRole + 3,
53 IsExpressionRole = Qt::UserRole + 4,
54 ExpressionValidityRole = Qt::UserRole + 5,
55 FieldTypeRole = Qt::UserRole + 6,
56 FieldOriginRole = Qt::UserRole + 7,
57 IsEmptyRole = Qt::UserRole + 8,
58 EditorWidgetType = Qt::UserRole + 9,
59 JoinedFieldIsEditable = Qt::UserRole + 10,
70 QModelIndex indexFromName(
const QString &fieldName );
77 void setAllowExpression(
bool allowExpression );
90 void setAllowEmptyFieldName(
bool allowEmpty );
103 bool isField(
const QString &expression )
const;
111 void setExpression(
const QString &expression );
118 void removeExpression();
127 QModelIndex index(
int row,
int column,
const QModelIndex &parent = QModelIndex() )
const override;
128 QModelIndex parent(
const QModelIndex &child )
const override;
129 int rowCount(
const QModelIndex &parent = QModelIndex() )
const override;
130 int columnCount(
const QModelIndex &parent )
const override;
131 QVariant data(
const QModelIndex &index,
int role )
const override;
138 static QString fieldToolTip(
const QgsField &field );
153 virtual void updateModel();
163 bool mAllowExpression =
false;
164 bool mAllowEmpty =
false;
170 #endif // QGSFIELDMODEL_H
Container of fields for a vector layer.
The QgsFieldModel class is a model to display the list of fields of a layer in widgets.
QgsVectorLayer * layer()
Returns the layer associated with the model.
Encapsulate a field in an attribute table or data source.
FieldRoles
Roles utilized by the model.
QList< QString > mExpression
bool allowEmptyFieldName() const
Returns true if the model allows the empty field ("not set") choice.
Represents a vector layer which manages a vector based data sets.
bool allowExpression()
Returns true if the model allows custom expressions to be created and displayed.