17 #ifndef QGSATTRIBUTETABLEMODEL_H
18 #define QGSATTRIBUTETABLEMODEL_H
20 #include <QAbstractTableModel>
22 #include <QModelIndex>
56 FeatureIdRole = Qt::UserRole,
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,
unsigned long cacheIndex = 0 );
213 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 );
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 );
327 virtual void layerDeleted();
338 QVector<QgsEditorWidgetFactory *> mWidgetFactories;
339 QVector<QgsFieldFormatter *> mFieldFormatters;
340 QVector<QVariant> mAttributeWidgetCaches;
341 QVector<QVariantMap> mWidgetConfigs;
343 QHash<QgsFeatureId, int> mIdRowMap;
344 QHash<int, QgsFeatureId> mRowIdMap;
345 mutable QHash<int, QList<QgsConditionalStyle> > mRowStylesMap;
352 virtual void loadAttributes();
373 QHash<QgsFeatureId, QVariant> sortCache;
376 std::vector<SortCache> mSortCaches;
380 int mExtraColumns = 0;
383 bool mBulkEditCommandRunning =
false;
386 bool mResettingModel =
false;
389 void bulkEditCommandStarted();
392 void bulkEditCommandEnded();
395 QMap<QPair<QgsFeatureId, int>, QVariant> mAttributeValueChanges;
397 friend class TestQgsAttributeTable;
This class contains context information for attribute editor widgets.
A model backed by a QgsVectorLayerCache which is able to provide feature/attribute information to a Q...
void resetModel()
Resets the model.
QgsVectorLayer * layer() const
Returns the layer this model uses as backend.
void modelChanged()
Model has been changed.
void progress(int i, bool &cancel)
void setEditorContext(const QgsAttributeEditorContext &context)
Sets the context in which this table is shown.
QgsVectorLayerCache * layerCache() const
Returns the layer cache this model uses as backend.
const QgsAttributeEditorContext & editorContext() const
Returns the context in which this table is shown.
@ SortRole
Role used for sorting start here.
@ FieldIndexRole
Get the field index of this column.
@ UserRole
Start further roles starting from this role.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Class for parsing and evaluation of expressions (formerly called "search strings").
This class wraps a request for features to a vector layer (or directly its vector data provider).
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Map canvas is a class for displaying all GIS data types on a canvas.
An action which can run on map layers.
This class caches features of a given QgsVectorLayer.
Represents a vector layer which manages a vector based data sets.
QSet< QgsFeatureId > QgsFeatureIds
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features
QList< int > QgsAttributeList