The QgsFieldModel class is a model to display the list of fields of a layer in widgets.
More...
#include <qgsfieldmodel.h>
|
static QString | fieldToolTip (const QgsField &field) |
| Returns a HTML formatted tooltip string for a field, containing details like the field name, alias and type. More...
|
|
The QgsFieldModel class is a model to display the list of fields of a layer in widgets.
If allowed, expressions might be added to the end of the model. It can be associated with a QgsMapLayerModel to dynamically display a layer and its fields.
- Since
- QGIS 2.3
Definition at line 37 of file qgsfieldmodel.h.
◆ FieldRoles
Roles utilized by the model.
Enumerator |
---|
FieldNameRole | Return field name if index corresponds to a field.
|
FieldIndexRole | Return field index if index corresponds to a field.
|
ExpressionRole | Return field name or expression.
|
IsExpressionRole | Return if index corresponds to an expression.
|
ExpressionValidityRole | Return if expression is valid or not.
|
FieldTypeRole | Return the field type (if a field, return QVariant if expression)
|
FieldOriginRole | Return the field origin (if a field, returns QVariant if expression)
|
IsEmptyRole | Return if the index corresponds to the empty value.
|
EditorWidgetType | Editor widget type.
|
JoinedFieldIsEditable | true if a joined field is editable (returns QVariant if not a joined field)
|
Definition at line 48 of file qgsfieldmodel.h.
◆ QgsFieldModel()
QgsFieldModel::QgsFieldModel |
( |
QObject * |
parent = nullptr | ) |
|
|
explicit |
◆ allowEmptyFieldName()
bool QgsFieldModel::allowEmptyFieldName |
( |
| ) |
const |
|
inline |
◆ allowExpression()
bool QgsFieldModel::allowExpression |
( |
| ) |
|
|
inline |
◆ columnCount()
int QgsFieldModel::columnCount |
( |
const QModelIndex & |
parent | ) |
const |
|
override |
◆ data()
QVariant QgsFieldModel::data |
( |
const QModelIndex & |
index, |
|
|
int |
role |
|
) |
| const |
|
override |
◆ fieldToolTip()
QString QgsFieldModel::fieldToolTip |
( |
const QgsField & |
field | ) |
|
|
static |
Returns a HTML formatted tooltip string for a field, containing details like the field name, alias and type.
- Since
- QGIS 3.0
Definition at line 463 of file qgsfieldmodel.cpp.
◆ index()
QModelIndex QgsFieldModel::index |
( |
int |
row, |
|
|
int |
column, |
|
|
const QModelIndex & |
parent = QModelIndex() |
|
) |
| const |
|
override |
◆ indexFromName()
QModelIndex QgsFieldModel::indexFromName |
( |
const QString & |
fieldName | ) |
|
Returns the index corresponding to a given fieldName.
Definition at line 32 of file qgsfieldmodel.cpp.
◆ isField()
bool QgsFieldModel::isField |
( |
const QString & |
expression | ) |
const |
Returns true
if a string represents a field reference, or false
if it is an expression consisting of more than direct field reference.
Definition at line 74 of file qgsfieldmodel.cpp.
◆ layer()
◆ parent()
QModelIndex QgsFieldModel::parent |
( |
const QModelIndex & |
child | ) |
const |
|
override |
◆ removeExpression()
void QgsFieldModel::removeExpression |
( |
| ) |
|
◆ rowCount()
int QgsFieldModel::rowCount |
( |
const QModelIndex & |
parent = QModelIndex() | ) |
const |
|
override |
◆ setAllowEmptyFieldName()
void QgsFieldModel::setAllowEmptyFieldName |
( |
bool |
allowEmpty | ) |
|
◆ setAllowExpression()
void QgsFieldModel::setAllowExpression |
( |
bool |
allowExpression | ) |
|
◆ setExpression()
void QgsFieldModel::setExpression |
( |
const QString & |
expression | ) |
|
◆ setLayer
◆ updateModel
void QgsFieldModel::updateModel |
( |
| ) |
|
|
protectedvirtualslot |
◆ mAllowEmpty
bool QgsFieldModel::mAllowEmpty = false |
|
protected |
◆ mAllowExpression
bool QgsFieldModel::mAllowExpression = false |
|
protected |
◆ mExpression
QList<QString> QgsFieldModel::mExpression |
|
protected |
◆ mFields
◆ mLayer
◆ allowEmptyFieldName
bool QgsFieldModel::allowEmptyFieldName |
|
readwrite |
◆ allowExpression
bool QgsFieldModel::allowExpression |
|
readwrite |
◆ layer
The documentation for this class was generated from the following files: