29 , mAllowExpression( false )
43 if ( !fieldNameWithAlias.
isNull() )
44 fldName = fieldNameWithAlias;
77 disconnect(
mLayer, SIGNAL( layerDeleted() ),
this, SLOT( layerDeleted() ) );
85 connect(
mLayer, SIGNAL( layerDeleted() ),
this, SLOT( layerDeleted() ) );
91 void QgsFieldModel::layerDeleted()
135 for (
int i = 0; i < newFields.
count(); ++i )
211 if (
hasIndex( row, column, parent ) )
243 static QIcon intIcon;
246 static QIcon floatIcon;
249 static QIcon stringIcon;
250 if ( stringIcon.
isNull() )
252 static QIcon dateIcon;
255 static QIcon dateTimeIcon;
256 if ( dateTimeIcon.
isNull() )
258 static QIcon timeIcon;
326 return static_cast< int >( field.
type() );
331 case Qt::DisplayRole:
338 else if ( role == Qt::EditRole )
350 case Qt::ForegroundRole:
381 case Qt::DecorationRole:
bool hasIndex(int row, int column, const QModelIndex &parent) const
QList< QgsField > toList() const
Utility function to return a list of QgsField instances.
QObject * child(const char *objName, const char *inheritsClass, bool recursiveSearch) const
Class for parsing and evaluation of expressions (formerly called "search strings").
bool hasParserError() const
Returns true if an error occurred when parsing the input expression.
QIcon iconForField(int fieldIdx) const
Returns an icon corresponding to a field index, based on the field's type and source.
Q_DECL_DEPRECATED bool prepare(const QgsFields &fields)
Get the expression ready for evaluation - find out column indexes.
QgsFields fields() const
Returns the list of fields of this layer.
static QIcon getThemeIcon(const QString &theName)
Helper to get a theme icon.
void setExpression(const QString &expression)
setExpression sets a single expression to be added after the fields at the end of the model ...
Container of fields for a vector layer.
bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method)
QgsVectorLayer * layer()
returns the currently used layer
bool isField(const QString &expression)
int indexOf(const T &value, int from) const
QVariant data(const QModelIndex &index, int role) const override
QgsFieldModel(QObject *parent=nullptr)
QgsFieldModel creates a model to display the fields of a given layer.
int count(const T &value) const
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
void removeExpression()
remove expressions from the model
QString attributeDisplayName(int attributeIndex) const
Convenience function that returns the attribute alias if defined or the field name else...
QString name() const
Gets the name of the field.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
void beginRemoveRows(const QModelIndex &parent, int first, int last)
void setLayer(QgsVectorLayer *layer)
set the layer of whch fields are displayed
void setAllowExpression(bool allowExpression)
returns the currently used layer
int rowCount(const QModelIndex &parent=QModelIndex()) const override
int count() const
Return number of items.
Encapsulate a field in an attribute table or data source.
const QMap< QString, QString > & attributeAliases() const
const QgsField & at(int i) const
Get field at particular index (must be in range 0..N-1)
void remove(int fieldIdx)
Remove a field with the given index.
void setFields(const QgsFields &fields)
Convenience function for setting a fields for the context.
QModelIndex createIndex(int row, int column, void *ptr) const
int indexFromName(const QString &name) const
Look up field's index from name. Returns -1 on error.
void setItalic(bool enable)
void beginInsertRows(const QModelIndex &parent, int first, int last)
const Key key(const T &value) const
int columnCount(const QModelIndex &parent) const override
virtual void updateModel()
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
QList< QString > mExpression
QModelIndex indexFromName(const QString &fieldName)
return the index corresponding to a given fieldName
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
Represents a vector layer which manages a vector based data sets.
QVariant::Type type() const
Gets variant type of the field as it will be retrieved from data source.