8 #include <QItemSelection>
13 , mInjectNull( false )
58 if ( mInjectNull && index.
row() == 0 )
60 if ( role == Qt::DisplayRole )
70 if ( role == Qt::DisplayRole || role == Qt::EditRole )
81 return mExpression->
evaluate( &context );
101 featInfo.
isNew =
true;
130 if ( mInjectNull != injectNull )
175 return mParserErrorString;
219 int offset = mInjectNull ? 1 : 0;
229 int offset = mInjectNull ? 1 : 0;
251 int offset = mInjectNull ? 1 : 0;
287 int offset = mInjectNull ? 1 : 0;
299 return QModelIndexList() <<
fidToIndex( fid );
QgsFeatureId id() const
Get the feature ID for this feature.
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const
bool injectNull()
Returns the current state of null value injection.
Class for parsing and evaluation of expressions (formerly called "search strings").
QModelIndex fidToIndex(QgsFeatureId fid) override
virtual int rowCount(const QModelIndex &parent) const =0
virtual QModelIndex mapFromSource(const QModelIndex &sourceIndex) const override
bool hasParserError() const
Returns true if an error occurred when parsing the input expression.
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const =0
Q_DECL_DEPRECATED QVariant evaluate(const QgsFeature *f)
Evaluate the feature and return the result.
bool setDisplayExpression(const QString &expression)
const QString expression() const
Alias for dump()
Q_DECL_DEPRECATED bool prepare(const QgsFields &fields)
Get the expression ready for evaluation - find out column indexes.
void setFeature(const QgsFeature &feature)
Convenience function for setting a feature for the context.
virtual QModelIndex mapToMaster(const QModelIndex &proxyIndex) const
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const override
virtual int columnCount(const QModelIndex &parent=QModelIndex()) const override
const QgsChangedAttributesMap & changedAttributeValues()
Changed attributes values which are not commited.
virtual QItemSelection mapSelectionFromSource(const QItemSelection &sourceSelection) const
void onEndInsertRows(const QModelIndex &parent, int first, int last)
QModelIndex idToIndex(QgsFeatureId id) const
bool featureByIndex(const QModelIndex &index, QgsFeature &feat)
virtual QItemSelection mapSelectionFromSource(const QItemSelection &sourceSelection) const
virtual QModelIndex mapFromMaster(const QModelIndex &sourceIndex) const
virtual QItemSelection mapSelectionToMaster(const QItemSelection &selection) const
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
A model backed by a QgsVectorLayerCache which is able to provide feature/attribute information to a Q...
void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end)
QString parserErrorString()
Returns a detailed message about errors while parsing a QgsExpression.
virtual void setSourceModel(QgsAttributeTableFilterModel *sourceModel)
void onBeginInsertRows(const QModelIndex &parent, int first, int last)
virtual QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
QgsVectorLayer * layer() const
Returns the layer this filter acts on.
QList< Key > keys() const
void layoutAboutToBeChanged()
QgsVectorLayerEditBuffer * editBuffer()
Buffer with uncommitted editing operations. Only valid after editing has been turned on...
void rowsAboutToBeInserted(const QModelIndex &parent, int start, int end)
static QgsExpressionContextScope * globalScope()
Creates a new scope which contains variables and functions relating to the global QGIS context...
QgsVectorLayerCache * layerCache() const
Returns the layerCache this filter acts on.
virtual QModelIndex mapToSource(const QModelIndex &proxyIndex) const override
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
virtual QModelIndex mapToMaster(const QModelIndex &proxyIndex) const
virtual QVariant data(const QModelIndex &index, int role) const override
virtual QItemSelection mapSelectionToSource(const QItemSelection &proxySelection) const
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
void beginRemoveRows(const QModelIndex &parent, int first, int last)
QModelIndexList fidToIndexList(QgsFeatureId fid)
virtual void setSourceModel(QAbstractItemModel *sourceModel)
virtual QVariant data(const QModelIndex &index, int role) const =0
virtual Qt::ItemFlags flags(const QModelIndex &index) const override
void rowsRemoved(const QModelIndex &parent, int start, int end)
QModelIndex createIndex(int row, int column, void *ptr) const
QgsAttributeTableModel * masterModel()
virtual QItemSelection mapSelectionToSource(const QItemSelection &proxySelection) const
void onBeginRemoveRows(const QModelIndex &parent, int first, int last)
This class caches features of a given QgsVectorLayer.
bool contains(const T &value) const
QVariant fromValue(const T &value)
void beginInsertRows(const QModelIndex &parent, int first, int last)
const QgsFeatureMap & addedFeatures()
New features which are not commited.
QVariant value(const QString &key, const QVariant &defaultValue) const
QAbstractItemModel * sourceModel() const
QgsAttributeTableModel * masterModel() const
Returns the table model this filter is using.
virtual QModelIndex mapFromMaster(const QModelIndex &sourceIndex) const
bool featureAtId(QgsFeatureId featureId, QgsFeature &feature, bool skipCache=false)
Gets the feature at the given feature id.
virtual ~QgsFeatureListModel()
QgsFeatureId idxToFid(const QModelIndex &index) const
void onEndRemoveRows(const QModelIndex &parent, int first, int last)
QgsVectorLayerCache * layerCache()
virtual Qt::ItemFlags flags(const QModelIndex &index) const
void setInjectNull(bool injectNull)
If true is specified, a NULL value will be injected.
QgsFeatureId rowToId(int row) const
Maps row to feature id.
static QgsExpressionContextScope * projectScope()
Creates a new scope which contains variables and functions relating to the current QGIS project...
static QgsExpressionContextScope * layerScope(const QgsMapLayer *layer)
Creates a new scope which contains variables and functions relating to a QgsMapLayer.
void rowsInserted(const QModelIndex &parent, int start, int end)
QModelIndex fidToIdx(const QgsFeatureId fid) const
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QgsFeatureListModel(QgsAttributeTableFilterModel *sourceModel, QObject *parent=0)
QString parserErrorString() const
Returns parser error.
virtual QItemSelection mapSelectionFromMaster(const QItemSelection &selection) const
QString displayExpression() const