17 #ifndef QGSATTRIBUTETABLEMODEL_H 18 #define QGSATTRIBUTETABLEMODEL_H 20 #include <QAbstractTableModel> 22 #include <QModelIndex> 57 SortRole = Qt::UserRole + 1,
76 int rowCount(
const QModelIndex &parent = QModelIndex() )
const override;
82 int columnCount(
const QModelIndex &parent = QModelIndex() )
const override;
90 QVariant headerData(
int section, Qt::Orientation orientation,
int role = Qt::DisplayRole )
const override;
97 QVariant data(
const QModelIndex &index,
int role )
const override;
105 bool setData(
const QModelIndex &index,
const QVariant &value,
int role = Qt::EditRole )
override;
111 Qt::ItemFlags flags(
const QModelIndex &index )
const override;
118 void reload(
const QModelIndex &index1,
const QModelIndex &index2 );
123 bool removeRows(
int row,
int count,
const QModelIndex &parent = QModelIndex() )
override;
145 int fieldIdx(
int col )
const;
150 int fieldCol(
int idx )
const;
178 void executeAction( QUuid action,
const QModelIndex &idx )
const;
183 void executeMapLayerAction(
QgsMapLayerAction *action,
const QModelIndex &idx )
const;
189 QgsFeature feature(
const QModelIndex &idx )
const;
198 void prefetchColumnData(
int column );
206 void prefetchSortData(
const QString &expression );
211 QString sortCacheExpression()
const;
248 int extraColumns()
const;
254 void setExtraColumns(
int extraColumns );
262 virtual void loadLayer();
269 void fieldConditionalStyleChanged(
const QString &fieldName );
279 void progress(
int i,
bool &cancel )
SIP_SKIP;
287 virtual void updatedFields();
294 virtual void editCommandEnded();
299 virtual void attributeDeleted(
int idx );
307 virtual void attributeValueChanged(
QgsFeatureId fid,
int idx,
const QVariant &value );
321 virtual void featureAdded(
QgsFeatureId fid,
bool resettingModel =
false );
326 virtual void layerDeleted();
337 QVector<QgsEditorWidgetFactory *> mWidgetFactories;
338 QVector<QgsFieldFormatter *> mFieldFormatters;
339 QVector<QVariant> mAttributeWidgetCaches;
340 QVector<QVariantMap> mWidgetConfigs;
342 QHash<QgsFeatureId, int> mIdRowMap;
343 QHash<int, QgsFeatureId> mRowIdMap;
344 mutable QHash<int, QList<QgsConditionalStyle> > mRowStylesMap;
351 virtual void loadAttributes();
367 QgsExpression mSortCacheExpression;
372 QHash<QgsFeatureId, QVariant> mSortCache;
381 QRect mChangedCellBounds;
387 friend class TestQgsAttributeTable;
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.
Get the feature id of the feature in this row.
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.
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.