17#ifndef QGSATTRIBUTETABLEMODEL_H
18#define QGSATTRIBUTETABLEMODEL_H
20#include <QAbstractTableModel>
85 int rowCount(
const QModelIndex &parent = QModelIndex() )
const override;
91 int columnCount(
const QModelIndex &parent = QModelIndex() )
const override;
99 QVariant headerData(
int section, Qt::Orientation orientation,
int role = Qt::DisplayRole )
const override;
106 QVariant data(
const QModelIndex &index,
int role )
const override;
114 bool setData(
const QModelIndex &index,
const QVariant &value,
int role = Qt::EditRole )
override;
120 Qt::ItemFlags flags(
const QModelIndex &index )
const override;
127 void reload(
const QModelIndex &index1,
const QModelIndex &index2 );
132 bool removeRows(
int row,
int count,
const QModelIndex &parent = QModelIndex() )
override;
154 int fieldIdx(
int col )
const;
159 int fieldCol(
int idx )
const;
187 void executeAction( QUuid action,
const QModelIndex &idx )
const;
198 QgsFeature feature(
const QModelIndex &idx )
const;
207 void prefetchColumnData(
int column );
215 void prefetchSortData(
const QString &expression,
unsigned long cacheIndex = 0 );
222 QString sortCacheExpression(
unsigned long cacheIndex = 0 )
const;
260 int extraColumns()
const;
266 void setExtraColumns(
int extraColumns );
288 virtual void loadLayer();
294 void fieldConditionalStyleChanged(
const QString &fieldName );
316 virtual void updatedFields();
323 virtual void editCommandEnded();
328 virtual void attributeDeleted(
int idx );
336 virtual void attributeValueChanged(
QgsFeatureId fid,
int idx,
const QVariant &value );
353 virtual void layerDeleted();
374 mutable QVector<WidgetData> mWidgetDatas;
376 QHash<QgsFeatureId, int> mIdRowMap;
377 QHash<int, QgsFeatureId> mRowIdMap;
378 mutable QHash<QgsFeatureId, QList<QgsConditionalStyle>> mRowStylesMap;
379 mutable QHash<QgsFeatureId, QHash<int, QgsConditionalStyle>> mConstraintStylesMap;
386 const WidgetData &getWidgetData(
int column )
const;
391 void loadAttributes();
412 virtual bool loadFeatureAtId(
QgsFeatureId fid,
int fieldIdx )
const;
424 QHash<QgsFeatureId, QVariant> sortCache;
427 std::vector<SortCache> mSortCaches;
431 int mExtraColumns = 0;
434 bool mBulkEditCommandRunning =
false;
437 bool mResettingModel =
false;
440 void bulkEditCommandStarted();
443 void bulkEditCommandEnded();
446 QMap<QPair<QgsFeatureId, int>, QVariant> mAttributeValueChanges;
449 QList<QgsFeatureId> mInsertedRowsChanges;
452 bool mIsCleaningUpAfterRollback =
false;
454 bool mShowValidityState =
false;
456 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...
const QgsAttributeEditorContext & editorContext() const
Returns the context in which this table is shown.
void resetModel()
Resets the model.
void modelChanged()
Emitted when the model has been changed.
void progress(int i, bool &cancel)
void setEditorContext(const QgsAttributeEditorContext &context)
Sets the context in which this table is shown.
QgsVectorLayer * layer() const
Returns the layer this model uses as backend.
QgsVectorLayerCache * layerCache() const
Returns the layer cache this model uses as backend.
void finished()
Emitted when the model has completely loaded all features.
void setShowValidityState(bool show)
Sets whether the attribute table will add a visual feedback to cells when an attribute constraint is ...
CustomRole
Custom model roles.
bool showValidityState() const
Returns whether the attribute table will add a visual feedback to cells when an attribute constraint ...
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 unique ID, geometry and a list of field...
Container of fields for a vector layer.
Map canvas is a class for displaying all GIS data types on a canvas.
Encapsulates the context in which a QgsMapLayerAction action is executed.
An action which can run on map layers The class can be used in two manners:
This class caches features of a given QgsVectorLayer.
Represents a vector layer which manages a vector based data sets.
#define SIP_MONKEYPATCH_SCOPEENUM_UNNEST(OUTSIDE_CLASS, FORMERNAME)
#define SIP_MONKEYPATCH_COMPAT_NAME(FORMERNAME)
QSet< QgsFeatureId > QgsFeatureIds
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features
QList< int > QgsAttributeList