QGIS API Documentation
2.8.2-Wien
|
#include <qgsattributetablefiltermodel.h>
Public Types | |
enum | FilterMode { ShowAll, ShowSelected, ShowVisible, ShowFilteredList, ShowEdited } |
Public Slots | |
void | extentsChanged () |
Is called upon every change of the visible extents on the map canvas. |
Public Member Functions | |
QgsAttributeTableFilterModel (QgsMapCanvas *canvas, QgsAttributeTableModel *sourceModel, QObject *parent=0) | |
Make sure, the master model is already loaded, so the selection will get synchronized. | |
QModelIndex | fidToIndex (QgsFeatureId fid) override |
QModelIndexList | fidToIndexList (QgsFeatureId fid) |
QgsFeatureIds | filteredFeatures () |
FilterMode | filterMode () |
QgsVectorLayer * | layer () const |
Returns the layer this filter acts on. | |
QgsVectorLayerCache * | layerCache () const |
Returns the layerCache this filter acts on. | |
virtual QModelIndex | mapFromMaster (const QModelIndex &sourceIndex) const |
virtual QModelIndex | mapToMaster (const QModelIndex &proxyIndex) const |
QgsAttributeTableModel * | masterModel () const |
Returns the table model this filter is using. | |
QgsFeatureId | rowToId (const QModelIndex &row) |
Returns the feature id for a given model index. | |
bool | selectedOnTop () |
Returns if selected features are currently shown on top. | |
virtual void | setFilteredFeatures (QgsFeatureIds ids) |
Specify a list of features, which the filter will accept. | |
void | setFilterMode (FilterMode filterMode) |
Set the filter mode the filter will use. | |
void | setSelectedOnTop (bool selectedOnTop) |
Changes the sort order of the features. | |
void | setSourceModel (QgsAttributeTableModel *sourceModel) |
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. | |
virtual void | sort (int column, Qt::SortOrder order=Qt::AscendingOrder) override |
Sort by the given column using the given order. |
Definition at line 31 of file qgsattributetablefiltermodel.h.
Definition at line 36 of file qgsattributetablefiltermodel.h.
QgsAttributeTableFilterModel::QgsAttributeTableFilterModel | ( | QgsMapCanvas * | canvas, |
QgsAttributeTableModel * | sourceModel, | ||
QObject * | parent = 0 |
||
) |
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 30 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 205 of file qgsattributetablefiltermodel.cpp.
|
overridevirtual |
Implements QgsFeatureModel.
Definition at line 313 of file qgsattributetablefiltermodel.cpp.
QModelIndexList QgsAttributeTableFilterModel::fidToIndexList | ( | QgsFeatureId | fid | ) |
Definition at line 318 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 168 of file qgsattributetablefiltermodel.cpp.
QgsFeatureIds QgsAttributeTableFilterModel::filteredFeatures | ( | ) |
Definition at line 133 of file qgsattributetablefiltermodel.cpp.
|
inline |
Definition at line 89 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 225 of file qgsattributetablefiltermodel.cpp.
|
inline |
Returns the layer this filter acts on.
Definition at line 96 of file qgsattributetablefiltermodel.h.
|
inline |
Returns the layerCache this filter acts on.
Definition at line 103 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 42 of file qgsattributetablefiltermodel.cpp.
|
virtual |
Definition at line 335 of file qgsattributetablefiltermodel.cpp.
|
virtual |
Definition at line 329 of file qgsattributetablefiltermodel.cpp.
|
inline |
Returns the table model this filter is using.
Definition at line 110 of file qgsattributetablefiltermodel.h.
QgsFeatureId QgsAttributeTableFilterModel::rowToId | ( | const QModelIndex & | row | ) |
Returns the feature id for a given model index.
row | A model index of the row in question |
Definition at line 308 of file qgsattributetablefiltermodel.cpp.
bool QgsAttributeTableFilterModel::selectedOnTop | ( | ) |
Returns if selected features are currently shown on top.
Definition at line 121 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 126 of file qgsattributetablefiltermodel.cpp.
void QgsAttributeTableFilterModel::setFilterMode | ( | FilterMode | filterMode | ) |
Set the filter mode the filter will use.
filterMode | Sets the current mode of the filter |
Definition at line 144 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 100 of file qgsattributetablefiltermodel.cpp.
void QgsAttributeTableFilterModel::setSourceModel | ( | QgsAttributeTableModel * | sourceModel | ) |
Definition at line 114 of file qgsattributetablefiltermodel.cpp.
|
overrideprotectedvirtual |
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 94 of file qgsattributetablefiltermodel.cpp.