16 #ifndef QGSFIELDMODEL_H
17 #define QGSFIELDMODEL_H
19 #include <QAbstractItemModel>
21 #include <QItemSelectionModel>
24 #include "qgis_core.h"
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;
140 static QString fieldToolTip(
const QgsField &field );
159 void setFields(
const QgsFields &fields );
184 virtual void updateModel();
194 bool mAllowExpression =
false;
195 bool mAllowEmpty =
false;
201 #endif // QGSFIELDMODEL_H