17#ifndef QGSATTRIBUTETABLEFILTERMODEL_H
18#define QGSATTRIBUTETABLEFILTERMODEL_H
26#include <QSortFilterProxyModel>
31class QItemSelectionModel;
53#pragma clang diagnostic push
54#pragma clang diagnostic ignored "-Woverloaded-virtual"
66#pragma clang diagnostic pop
155 QModelIndex mapToMaster(
const QModelIndex &proxyIndex )
const;
157 inline QModelIndex
mapFromMaster(
const QModelIndex &sourceIndex )
const {
return mapFromSource( sourceIndex ); }
166 void sort(
int column, Qt::SortOrder order = Qt::AscendingOrder )
override;
175 void sort(
const QString &expression, Qt::SortOrder order = Qt::AscendingOrder );
180 QString sortExpression()
const;
249 bool filterAcceptsRow(
int sourceRow,
const QModelIndex &sourceParent )
const override;
261 bool lessThan(
const QModelIndex &left,
const QModelIndex &right )
const override;
282 void selectionChanged();
283 void onColumnsChanged();
284 void reloadVisible();
285 void onAttributeValueChanged(
QgsFeatureId fid,
int idx,
const QVariant &value );
286 void onGeometryChanged();
292 bool mSelectedOnTop =
false;
300 QTimer mReloadVisibleTimer;
301 QTimer mFilterFeaturesTimer;
302 void startTimedReloadVisible();
303 void startTimedFilterFeatures();
AttributeTableFilterMode
Defines how rows in attribute tables should be filtered.
@ ShowAll
Show all features.
A container for configuration of the attribute table.
QgsFeatureIds filteredFeatures() const
Gets a list of currently filtered feature ids.
Q_DECL_DEPRECATED void extentsChanged()
Is called upon every change of the visible extents on the map canvas.
QgsAttributeTableFilterModel(QgsMapCanvas *canvas, QgsAttributeTableModel *sourceModel, QObject *parent=nullptr)
Make sure, the master model is already loaded, so the selection will get synchronized.
QgsMapCanvas * mapCanvas() const
Returns the map canvas.
void setFilterMode(Qgis::AttributeTableFilterMode filterMode)
Set the filter mode the filter will use.
QgsVectorLayerCache * layerCache() const
Returns the layerCache this filter acts on.
QString filterExpression() const
Returns the stored filter expression string.
void generateListOfVisibleFeatures()
Updates the list of currently visible features on the map canvas.
void disconnectFilterModeConnections()
Disconnect the connections set for the current filterMode.
bool lessThan(const QModelIndex &left, const QModelIndex &right) const override
Used by the sorting algorithm.
bool selectedOnTop()
Returns if selected features are currently shown on top.
void filterError(const QString &errorMessage)
Emitted when an error occurred while filtering features.
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override
Returns true if the source row will be accepted.
void connectFilterModeConnections(Qgis::AttributeTableFilterMode filterMode)
Disconnect the connections set for the new filterMode.
QModelIndex mapFromMaster(const QModelIndex &sourceIndex) const
void filterFeatures()
Updates the filtered features in the filter model.
virtual void setFilteredFeatures(const QgsFeatureIds &ids)
Specify a list of features, which the filter will accept.
QgsAttributeTableModel * masterModel() const
Returns the table model this filter is using.
Qgis::AttributeTableFilterMode filterMode()
The current filterModel.
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).
void setSourceModel(QgsAttributeTableModel *sourceModel)
Set the attribute table model that backs this model.
QgsVectorLayer * layer() const
Returns the layer this filter acts on.
void setSelectedOnTop(bool selectedOnTop)
Changes the sort order of the features.
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...
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Handles parsing and evaluation of expressions (formerly called "search strings").
Base class for feature models.
virtual QModelIndex fidToIndex(QgsFeatureId fid)=0
Map canvas is a class for displaying all GIS data types on a canvas.
Caches features for a given QgsVectorLayer.
Represents a vector layer which manages a vector based dataset.
QSet< QgsFeatureId > QgsFeatureIds
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features