17 #ifndef QGSATTRIBUTETABLEFILTERMODEL_H
18 #define QGSATTRIBUTETABLEFILTERMODEL_H
20 #include <QSortFilterProxyModel>
21 #include <QModelIndex>
30 class QItemSelectionModel;
61 ColumnTypeActionButton
100 void setSelectedOnTop(
bool selectedOnTop );
107 bool selectedOnTop();
115 virtual void setFilteredFeatures(
const QgsFeatureIds &ids );
129 void setFilterMode( FilterMode filterMode );
134 void disconnectFilterModeConnections();
139 void connectFilterModeConnections( FilterMode filterMode );
180 inline QModelIndex
mapToMaster(
const QModelIndex &proxyIndex )
const {
return mapToSource( proxyIndex ); }
182 inline QModelIndex
mapFromMaster(
const QModelIndex &sourceIndex )
const {
return mapFromSource( sourceIndex ); }
184 QModelIndex mapToSource(
const QModelIndex &proxyIndex )
const override;
186 QModelIndex mapFromSource(
const QModelIndex &sourceIndex )
const override;
188 Qt::ItemFlags flags(
const QModelIndex &index )
const override;
197 void sort(
int column, Qt::SortOrder order = Qt::AscendingOrder )
override;
206 void sort(
const QString &expression, Qt::SortOrder order = Qt::AscendingOrder );
211 QString sortExpression()
const;
216 QVariant data(
const QModelIndex &index,
int role )
const override;
218 QVariant headerData(
int section, Qt::Orientation orientation,
int role )
const override;
224 int actionColumnIndex()
const;
226 int columnCount(
const QModelIndex &parent )
const override;
276 bool filterAcceptsRow(
int sourceRow,
const QModelIndex &sourceParent )
const override;
282 void generateListOfVisibleFeatures();
288 bool lessThan(
const QModelIndex &left,
const QModelIndex &right )
const override;
298 Q_DECL_DEPRECATED
void extentsChanged();
306 void filterFeatures();
309 void selectionChanged();
310 void onColumnsChanged();
311 void reloadVisible();
312 void onAttributeValueChanged(
QgsFeatureId fid,
int idx,
const QVariant &value );
313 void onGeometryChanged();
319 bool mSelectedOnTop =
false;
323 QVector<int> mColumnMapping;
327 int mapColumnToSource(
int column )
const;
328 int mapColumnFromSource(
int column )
const;
330 QTimer mReloadVisibleTimer;
331 QTimer mFilterFeaturesTimer;
332 void startTimedReloadVisible();
333 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.
QgsVectorLayer * layer() const
Returns the layer this filter acts on.
QgsMapCanvas * mapCanvas() const
Returns the map canvas.
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.
@ ShowAll
Show all features.
void filterError(const QString &errorMessage)
Emitted when an error occurred while filtering features.
QModelIndex mapFromMaster(const QModelIndex &sourceIndex) const
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.
QgsVectorLayerCache * layerCache() const
Returns the layerCache this filter acts on.
QgsAttributeTableModel * masterModel() const
Returns the table model this filter is using.
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