17#ifndef QGSATTRIBUTETABLEFILTERMODEL_H
18#define QGSATTRIBUTETABLEFILTERMODEL_H
20#include <QSortFilterProxyModel>
30class QItemSelectionModel;
62 ColumnTypeActionButton
87#pragma clang diagnostic push
88#pragma clang diagnostic ignored "-Woverloaded-virtual"
101#pragma clang diagnostic pop
110 void setSelectedOnTop(
bool selectedOnTop );
117 bool selectedOnTop();
125 virtual void setFilteredFeatures(
const QgsFeatureIds &ids );
139 void setFilterMode( FilterMode filterMode );
144 void disconnectFilterModeConnections();
149 void connectFilterModeConnections( FilterMode filterMode );
190 inline QModelIndex
mapToMaster(
const QModelIndex &proxyIndex )
const {
return mapToSource( proxyIndex ); }
192 inline QModelIndex
mapFromMaster(
const QModelIndex &sourceIndex )
const {
return mapFromSource( sourceIndex ); }
194 QModelIndex mapToSource(
const QModelIndex &proxyIndex )
const override;
196 QModelIndex mapFromSource(
const QModelIndex &sourceIndex )
const override;
198 Qt::ItemFlags flags(
const QModelIndex &index )
const override;
207 void sort(
int column, Qt::SortOrder order = Qt::AscendingOrder )
override;
216 void sort(
const QString &expression, Qt::SortOrder order = Qt::AscendingOrder );
221 QString sortExpression()
const;
226 QVariant data(
const QModelIndex &index,
int role )
const override;
228 QVariant headerData(
int section, Qt::Orientation orientation,
int role )
const override;
234 int actionColumnIndex()
const;
236 int columnCount(
const QModelIndex &parent )
const override;
295 bool filterAcceptsRow(
int sourceRow,
const QModelIndex &sourceParent )
const override;
301 void generateListOfVisibleFeatures();
307 bool lessThan(
const QModelIndex &left,
const QModelIndex &right )
const override;
317 Q_DECL_DEPRECATED
void extentsChanged();
325 void filterFeatures();
328 void selectionChanged();
329 void onColumnsChanged();
330 void reloadVisible();
331 void onAttributeValueChanged(
QgsFeatureId fid,
int idx,
const QVariant &value );
332 void onGeometryChanged();
338 bool mSelectedOnTop =
false;
342 QVector<int> mColumnMapping;
346 int mapColumnToSource(
int column )
const;
347 int mapColumnFromSource(
int column )
const;
349 QTimer mReloadVisibleTimer;
350 QTimer mFilterFeaturesTimer;
351 void startTimedReloadVisible();
352 void startTimedFilterFeatures();
This is a container for configuration of the attribute table.
FilterMode filterMode()
The current filterModel.
Role
The additional roles defined by this filter model.
QgsMapCanvas * mapCanvas() const
Returns the map canvas.
QgsVectorLayerCache * layerCache() const
Returns the layerCache this filter acts on.
QString filterExpression() const
Returns the stored filter expression string.
FilterMode
The filter mode defines how the rows should be filtered.
@ ShowFilteredList
Show only features whose ids are on the filter list. {.
@ ShowVisible
Show only visible features (depends on the map canvas)
@ ShowSelected
Show only selected features.
@ ShowInvalid
Show only features not respecting constraints (since QGIS 3.30)
@ ShowEdited
Show only features which have unsaved changes.
@ ShowAll
Show all features.
void filterError(const QString &errorMessage)
Emitted when an error occurred while filtering features.
QModelIndex mapFromMaster(const QModelIndex &sourceIndex) const
QgsAttributeTableModel * masterModel() const
Returns the table model this filter is using.
QModelIndex mapToMaster(const QModelIndex &proxyIndex) const
void featuresFiltered()
Emitted when the filtering of the features has been done.
void visibleReloaded()
Emitted when the the visible features on extend are reloaded (the list is created)
ColumnType
The type of a column.
@ ColumnTypeField
This column shows a field.
QgsVectorLayer * layer() const
Returns the layer this filter acts on.
void sortColumnChanged(int column, Qt::SortOrder order)
Emitted whenever the sort column is changed.
A model backed by a QgsVectorLayerCache which is able to provide feature/attribute information to a Q...
@ 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").
virtual QModelIndex fidToIndex(QgsFeatureId fid)=0
Map canvas is a class for displaying all GIS data types on a canvas.
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