|
QGIS API Documentation 4.3.0-Master (bd2f5e21fd1)
|
A proxy model for filtering an attribute table model. More...
#include <qgsattributetablefiltermodel.h>

Public Slots | |
| Q_DECL_DEPRECATED void | extentsChanged () |
| Is called upon every change of the visible extents on the map canvas. | |
| void | filterFeatures () |
| Updates the filtered features in the filter model. | |
Signals | |
| void | featuresFiltered () |
| Emitted when the filtering of the features has been done. | |
| void | filterError (const QString &errorMessage) |
| Emitted when an error occurred while filtering features. | |
| void | sortColumnChanged (int column, Qt::SortOrder order) |
| Emitted whenever the sort column is changed. | |
| void | visibleReloaded () |
| Emitted when the the visible features on extend are reloaded (the list is created). | |
Public Member Functions | |
| QgsAttributeTableFilterModel (QgsMapCanvas *canvas, QgsAttributeTableModel *sourceModel, QObject *parent=nullptr) | |
| Make sure, the master model is already loaded, so the selection will get synchronized. | |
| Q_DECL_DEPRECATED int | actionColumnIndex () const |
| Gets the index of the first column that contains an action widget. | |
| void | connectFilterModeConnections (Qgis::AttributeTableFilterMode filterMode) |
| Disconnect the connections set for the new filterMode. | |
| void | disconnectFilterModeConnections () |
| Disconnect the connections set for the current filterMode. | |
| QModelIndex | fidToIndex (QgsFeatureId fid) override |
| QModelIndexList | fidToIndexList (QgsFeatureId fid) |
| QgsFeatureIds | filteredFeatures () const |
| Gets a list of currently filtered feature ids. | |
| QString | filterExpression () const |
| Returns the stored filter expression string. | |
| Qgis::AttributeTableFilterMode | filterMode () |
| The current filterModel. | |
| QgsVectorLayer * | layer () const |
| Returns the layer this filter acts on. | |
| QgsVectorLayerCache * | layerCache () const |
| Returns the layerCache this filter acts on. | |
| QgsMapCanvas * | mapCanvas () const |
| Returns the map canvas. | |
| QModelIndex | mapFromMaster (const QModelIndex &sourceIndex) const |
| QModelIndex | mapToMaster (const QModelIndex &proxyIndex) const |
| QgsAttributeTableModel * | masterModel () const |
| Returns the table model this filter is using. | |
| QgsFeatureId | rowToId (const QModelIndex &row) const |
| Returns the feature id for a given model index. | |
| bool | selectedOnTop () |
| Returns if selected features are currently shown on top. | |
| void | setAttributeTableConfig (const QgsAttributeTableConfig &config, bool force=false) |
| Set the attribute table configuration to control which fields are shown, in which order they are shown as well as if and where an action column is shown. | |
| virtual void | setFilteredFeatures (const QgsFeatureIds &ids) |
| Specify a list of features, which the filter will accept. | |
| void | setFilterExpression (const QgsExpression &expression, const QgsExpressionContext &context) |
| Set the expression and the context to be stored in case of the features need to be filtered again (like on filter or on main model data change). | |
| void | setFilterMode (Qgis::AttributeTableFilterMode filterMode) |
| Set the filter mode the filter will use. | |
| void | setSelectedOnTop (bool selectedOnTop) |
| Changes the sort order of the features. | |
| void | setSourceModel (QgsAttributeTableModel *sourceModel) |
| Set the attribute table model that backs this model. | |
| void | sort (const QString &expression, Qt::SortOrder order=Qt::AscendingOrder) |
| Sort by the given expression using the given order. | |
| void | sort (int column, Qt::SortOrder order=Qt::AscendingOrder) override |
| Sort by the given column using the given order. | |
| QString | sortExpression () const |
| The expression which is used to sort the attribute table. | |
| Public Member Functions inherited from QgsFeatureModel | |
| virtual | ~QgsFeatureModel ()=default |
Protected Member Functions | |
| bool | filterAcceptsRow (int sourceRow, const QModelIndex &sourceParent) const override |
Returns true if the source row will be accepted. | |
| void | generateListOfVisibleFeatures () |
| Updates the list of currently visible features on the map canvas. | |
| bool | lessThan (const QModelIndex &left, const QModelIndex &right) const override |
| Used by the sorting algorithm. | |
A proxy model for filtering an attribute table model.
Definition at line 38 of file qgsattributetablefiltermodel.h.
| QgsAttributeTableFilterModel::QgsAttributeTableFilterModel | ( | QgsMapCanvas * | canvas, |
| QgsAttributeTableModel * | sourceModel, | ||
| QObject * | parent = nullptr ) |
Make sure, the master model is already loaded, so the selection will get synchronized.
| parent | parent object (owner) |
| sourceModel | The QgsAttributeTableModel to use as source (mostly referred to as master model) |
| canvas | The mapCanvas. Used to identify the currently visible features. |
Definition at line 45 of file qgsattributetablefiltermodel.cpp.
| int QgsAttributeTableFilterModel::actionColumnIndex | ( | ) | const |
Gets the index of the first column that contains an action widget.
Returns -1 if none is defined.
Definition at line 100 of file qgsattributetablefiltermodel.cpp.
| void QgsAttributeTableFilterModel::connectFilterModeConnections | ( | Qgis::AttributeTableFilterMode | filterMode | ) |
Disconnect the connections set for the new filterMode.
Definition at line 241 of file qgsattributetablefiltermodel.cpp.
| void QgsAttributeTableFilterModel::disconnectFilterModeConnections | ( | ) |
Disconnect the connections set for the current filterMode.
Definition at line 217 of file qgsattributetablefiltermodel.cpp.
|
slot |
Is called upon every change of the visible extents on the map canvas.
When a change is signalled, the filter is updated and invalidated if needed.
Definition at line 312 of file qgsattributetablefiltermodel.cpp.
|
signal |
Emitted when the filtering of the features has been done.
|
overridevirtual |
Implements QgsFeatureModel.
Definition at line 529 of file qgsattributetablefiltermodel.cpp.
| QModelIndexList QgsAttributeTableFilterModel::fidToIndexList | ( | QgsFeatureId | fid | ) |
Definition at line 534 of file qgsattributetablefiltermodel.cpp.
|
overrideprotected |
Returns true if the source row will be accepted.
| sourceRow | row from the source model |
| sourceParent | parent index in the source model |
Definition at line 266 of file qgsattributetablefiltermodel.cpp.
| QgsFeatureIds QgsAttributeTableFilterModel::filteredFeatures | ( | ) | const |
Gets a list of currently filtered feature ids.
Definition at line 189 of file qgsattributetablefiltermodel.cpp.
|
signal |
Emitted when an error occurred while filtering features.
|
inline |
Returns the stored filter expression string.
Definition at line 215 of file qgsattributetablefiltermodel.h.
|
slot |
Updates the filtered features in the filter model.
It is called when the data of the main table or the filter expression changed.
Definition at line 353 of file qgsattributetablefiltermodel.cpp.
|
inline |
The current filterModel.
Definition at line 119 of file qgsattributetablefiltermodel.h.
|
protected |
Updates the list of currently visible features on the map canvas.
Is called automatically when the filter mode is adjusted or the extents changed.
Definition at line 434 of file qgsattributetablefiltermodel.cpp.
|
inline |
Returns the layer this filter acts on.
Definition at line 126 of file qgsattributetablefiltermodel.h.
|
inline |
Returns the layerCache this filter acts on.
Definition at line 133 of file qgsattributetablefiltermodel.h.
|
overrideprotected |
Used by the sorting algorithm.
Compares the two model indices. Will also consider the selection state of the feature in case selected features are to be shown on top.
Definition at line 60 of file qgsattributetablefiltermodel.cpp.
|
inline |
Returns the map canvas.
Definition at line 183 of file qgsattributetablefiltermodel.h.
|
inline |
Definition at line 157 of file qgsattributetablefiltermodel.h.
| QModelIndex QgsAttributeTableFilterModel::mapToMaster | ( | const QModelIndex & | proxyIndex | ) | const |
Definition at line 546 of file qgsattributetablefiltermodel.cpp.
|
inline |
Returns the table model this filter is using.
Definition at line 140 of file qgsattributetablefiltermodel.h.
| QgsFeatureId QgsAttributeTableFilterModel::rowToId | ( | const QModelIndex & | row | ) | const |
Returns the feature id for a given model index.
| row | A model index of the row in question |
Definition at line 524 of file qgsattributetablefiltermodel.cpp.
| bool QgsAttributeTableFilterModel::selectedOnTop | ( | ) |
Returns if selected features are currently shown on top.
true if selected are shown on top Definition at line 174 of file qgsattributetablefiltermodel.cpp.
| void QgsAttributeTableFilterModel::setAttributeTableConfig | ( | const QgsAttributeTableConfig & | config, |
| bool | force = false ) |
Set the attribute table configuration to control which fields are shown, in which order they are shown as well as if and where an action column is shown.
| config | attribute table config |
| force | default false, if true the attribute table configuration will be reset even if it is not changed. |
Definition at line 105 of file qgsattributetablefiltermodel.cpp.
|
virtual |
Specify a list of features, which the filter will accept.
The filter mode will automatically be adjusted to show only these features (ShowFilteredList).
| ids | The list of feature ids which will be accepted by the filter |
Definition at line 179 of file qgsattributetablefiltermodel.cpp.
| void QgsAttributeTableFilterModel::setFilterExpression | ( | const QgsExpression & | expression, |
| const QgsExpressionContext & | context ) |
Set the expression and the context to be stored in case of the features need to be filtered again (like on filter or on main model data change).
Definition at line 122 of file qgsattributetablefiltermodel.cpp.
| void QgsAttributeTableFilterModel::setFilterMode | ( | Qgis::AttributeTableFilterMode | filterMode | ) |
Set the filter mode the filter will use.
| filterMode | Sets the current mode of the filter |
Definition at line 201 of file qgsattributetablefiltermodel.cpp.
| void QgsAttributeTableFilterModel::setSelectedOnTop | ( | bool | selectedOnTop | ) |
Changes the sort order of the features.
If set to true, selected features will be sorted on top, regardless of the current sort column
| selectedOnTop | Specify, if selected features should be sorted on top |
Definition at line 143 of file qgsattributetablefiltermodel.cpp.
| void QgsAttributeTableFilterModel::setSourceModel | ( | QgsAttributeTableModel * | sourceModel | ) |
Set the attribute table model that backs this model.
| sourceModel | The model |
Definition at line 163 of file qgsattributetablefiltermodel.cpp.
| void QgsAttributeTableFilterModel::sort | ( | const QString & | expression, |
| Qt::SortOrder | order = Qt::AscendingOrder ) |
Sort by the given expression using the given order.
Prefetches all the data from the layer to speed up sorting.
| expression | The expression which should be used for sorting |
| order | The order ( Qt::AscendingOrder or Qt::DescendingOrder ) |
Definition at line 128 of file qgsattributetablefiltermodel.cpp.
|
override |
Sort by the given column using the given order.
Prefetches all the data from the layer to speed up sorting.
| column | The column which should be sorted |
| order | The order ( Qt::AscendingOrder or Qt::DescendingOrder ) |
Definition at line 86 of file qgsattributetablefiltermodel.cpp.
|
signal |
Emitted whenever the sort column is changed.
| column | The sort column |
| order | The sort order |
| QString QgsAttributeTableFilterModel::sortExpression | ( | ) | const |
The expression which is used to sort the attribute table.
Definition at line 138 of file qgsattributetablefiltermodel.cpp.
|
signal |
Emitted when the the visible features on extend are reloaded (the list is created).