17 #ifndef QGSATTRIBUTETABLEMODEL_H 18 #define QGSATTRIBUTETABLEMODEL_H 20 #include <QAbstractTableModel> 22 #include <QModelIndex> 57 FeatureIdRole = Qt::UserRole,
77 int rowCount(
const QModelIndex &parent = QModelIndex() )
const override;
83 int columnCount(
const QModelIndex &parent = QModelIndex() )
const override;
91 QVariant headerData(
int section, Qt::Orientation orientation,
int role = Qt::DisplayRole )
const override;
98 QVariant data(
const QModelIndex &index,
int role )
const override;
106 bool setData(
const QModelIndex &index,
const QVariant &value,
int role = Qt::EditRole )
override;
112 Qt::ItemFlags flags(
const QModelIndex &index )
const override;
119 void reload(
const QModelIndex &index1,
const QModelIndex &index2 );
124 bool removeRows(
int row,
int count,
const QModelIndex &parent = QModelIndex() )
override;
146 int fieldIdx(
int col )
const;
151 int fieldCol(
int idx )
const;
179 void executeAction( QUuid action,
const QModelIndex &idx )
const;
184 void executeMapLayerAction(
QgsMapLayerAction *action,
const QModelIndex &idx )
const;
190 QgsFeature feature(
const QModelIndex &idx )
const;
199 void prefetchColumnData(
int column );
207 void prefetchSortData(
const QString &expression,
unsigned long cacheIndex = 0 );
214 QString sortCacheExpression(
unsigned long cacheIndex = 0 )
const;
251 int extraColumns()
const;
257 void setExtraColumns(
int extraColumns );
265 virtual void loadLayer();
272 void fieldConditionalStyleChanged(
const QString &fieldName );
282 void progress(
int i,
bool &cancel )
SIP_SKIP;
290 virtual void updatedFields();
297 virtual void editCommandEnded();
302 virtual void attributeDeleted(
int idx );
310 virtual void attributeValueChanged(
QgsFeatureId fid,
int idx,
const QVariant &value );
324 virtual void featureAdded(
QgsFeatureId fid,
bool resettingModel =
false );
329 virtual void layerDeleted();
340 QVector<QgsEditorWidgetFactory *> mWidgetFactories;
341 QVector<QgsFieldFormatter *> mFieldFormatters;
342 QVector<QVariant> mAttributeWidgetCaches;
343 QVector<QVariantMap> mWidgetConfigs;
345 QHash<QgsFeatureId, int> mIdRowMap;
346 QHash<int, QgsFeatureId> mRowIdMap;
347 mutable QHash<int, QList<QgsConditionalStyle> > mRowStylesMap;
354 virtual void loadAttributes();
377 QHash<QgsFeatureId, QVariant> sortCache;
380 std::vector<SortCache> mSortCaches;
389 QRect mChangedCellBounds;
393 int mExtraColumns = 0;
395 friend class TestQgsAttributeTable;
Class for parsing and evaluation of expressions (formerly called "search strings").
QgsVectorLayer * layer() const
Returns the layer this model uses as backend.
Get the field index of this column.
QSet< QgsFeatureId > QgsFeatureIds
This class contains context information for attribute editor widgets.
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...
Map canvas is a class for displaying all GIS data types on a canvas.
void resetModel()
Resets the model.
Roles used for sorting start here.
void setEditorContext(const QgsAttributeEditorContext &context)
Sets the context in which this table is shown.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
This class wraps a request for features to a vector layer (or directly its vector data provider)...
QgsVectorLayerCache * layerCache() const
Returns the layer cache this model uses as backend.
This class caches features of a given QgsVectorLayer.
Start further roles starting from this role.
const QgsAttributeEditorContext & editorContext() const
Returns the context in which this table is shown.
QList< int > QgsAttributeList
Represents a vector layer which manages a vector based data sets.
An action which can run on map layers.