QGIS API Documentation  2.7.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Types | Public Slots | Public Member Functions | Protected Member Functions | List of all members
QgsAttributeTableFilterModel Class Reference

#include <qgsattributetablefiltermodel.h>

Inheritance diagram for QgsAttributeTableFilterModel:
Inheritance graph
[legend]

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. More...
 

Public Member Functions

 QgsAttributeTableFilterModel (QgsMapCanvas *canvas, QgsAttributeTableModel *sourceModel, QObject *parent=NULL)
 Make sure, the master model is already loaded, so the selection will get synchronized. More...
 
QModelIndex fidToIndex (QgsFeatureId fid)
 
QModelIndexList fidToIndexList (QgsFeatureId fid)
 
QgsFeatureIds filteredFeatures ()
 
FilterMode filterMode ()
 
QgsVectorLayerlayer () const
 Returns the layer this filter acts on. More...
 
QgsVectorLayerCachelayerCache () const
 Returns the layerCache this filter acts on. More...
 
virtual QModelIndex mapFromMaster (const QModelIndex &sourceIndex) const
 
virtual QModelIndex mapToMaster (const QModelIndex &proxyIndex) const
 
QgsAttributeTableModelmasterModel () const
 Returns the table model this filter is using. More...
 
QgsFeatureId rowToId (const QModelIndex &row)
 Returns the feature id for a given model index. More...
 
bool selectedOnTop ()
 Returns if selected features are currently shown on top. More...
 
virtual void setFilteredFeatures (QgsFeatureIds ids)
 Specify a list of features, which the filter will accept. More...
 
void setFilterMode (FilterMode filterMode)
 Set the filter mode the filter will use. More...
 
void setSelectedOnTop (bool selectedOnTop)
 Changes the sort order of the features. More...
 
void setSourceModel (QgsAttributeTableModel *sourceModel)
 

Protected Member Functions

bool filterAcceptsRow (int sourceRow, const QModelIndex &sourceParent) const
 Returns true if the source row will be accepted. More...
 
void generateListOfVisibleFeatures ()
 Updates the list of currently visible features on the map canvas. More...
 
bool lessThan (const QModelIndex &left, const QModelIndex &right) const
 Used by the sorting algorithm. More...
 
virtual void sort (int column, Qt::SortOrder order=Qt::AscendingOrder)
 Sort by the given column using the given order. More...
 

Detailed Description

Definition at line 31 of file qgsattributetablefiltermodel.h.

Member Enumeration Documentation

Enumerator
ShowAll 
ShowSelected 
ShowVisible 
ShowFilteredList 
ShowEdited 

Definition at line 36 of file qgsattributetablefiltermodel.h.

Constructor & Destructor Documentation

QgsAttributeTableFilterModel::QgsAttributeTableFilterModel ( QgsMapCanvas canvas,
QgsAttributeTableModel sourceModel,
QObject *  parent = NULL 
)

Make sure, the master model is already loaded, so the selection will get synchronized.

Parameters
parentparent object (owner)
sourceModelThe QgsAttributeTableModel to use as source (mostly referred to as master model)
canvasThe mapCanvas. Used to identify the currently visible features.

Definition at line 30 of file qgsattributetablefiltermodel.cpp.

Member Function Documentation

void QgsAttributeTableFilterModel::extentsChanged ( )
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.

QModelIndex QgsAttributeTableFilterModel::fidToIndex ( QgsFeatureId  fid)
virtual

Implements QgsFeatureModel.

Definition at line 304 of file qgsattributetablefiltermodel.cpp.

QModelIndexList QgsAttributeTableFilterModel::fidToIndexList ( QgsFeatureId  fid)

Definition at line 309 of file qgsattributetablefiltermodel.cpp.

bool QgsAttributeTableFilterModel::filterAcceptsRow ( int  sourceRow,
const QModelIndex &  sourceParent 
) const
protected

Returns true if the source row will be accepted.

Parameters
sourceRowrow from the source model
sourceParentparent index in the source model

Definition at line 168 of file qgsattributetablefiltermodel.cpp.

QgsFeatureIds QgsAttributeTableFilterModel::filteredFeatures ( )

Definition at line 133 of file qgsattributetablefiltermodel.cpp.

FilterMode QgsAttributeTableFilterModel::filterMode ( )
inline

Definition at line 89 of file qgsattributetablefiltermodel.h.

void QgsAttributeTableFilterModel::generateListOfVisibleFeatures ( )
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.

QgsVectorLayer* QgsAttributeTableFilterModel::layer ( ) const
inline

Returns the layer this filter acts on.

Returns
Abovementioned layer

Definition at line 96 of file qgsattributetablefiltermodel.h.

QgsVectorLayerCache* QgsAttributeTableFilterModel::layerCache ( ) const
inline

Returns the layerCache this filter acts on.

Returns
The layer cache

Definition at line 103 of file qgsattributetablefiltermodel.h.

bool QgsAttributeTableFilterModel::lessThan ( const QModelIndex &  left,
const QModelIndex &  right 
) const
protected

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.

QModelIndex QgsAttributeTableFilterModel::mapFromMaster ( const QModelIndex &  sourceIndex) const
virtual

Definition at line 326 of file qgsattributetablefiltermodel.cpp.

QModelIndex QgsAttributeTableFilterModel::mapToMaster ( const QModelIndex &  proxyIndex) const
virtual

Definition at line 320 of file qgsattributetablefiltermodel.cpp.

QgsAttributeTableModel* QgsAttributeTableFilterModel::masterModel ( ) const
inline

Returns the table model this filter is using.

Returns
the table model in quesion

Definition at line 110 of file qgsattributetablefiltermodel.h.

QgsFeatureId QgsAttributeTableFilterModel::rowToId ( const QModelIndex &  row)

Returns the feature id for a given model index.

Parameters
rowA model index of the row in question
Returns
The feature id of the feature visible in the provided row

Definition at line 299 of file qgsattributetablefiltermodel.cpp.

bool QgsAttributeTableFilterModel::selectedOnTop ( )

Returns if selected features are currently shown on top.

Returns
True if selected are shown on top

Definition at line 121 of file qgsattributetablefiltermodel.cpp.

void QgsAttributeTableFilterModel::setFilteredFeatures ( QgsFeatureIds  ids)
virtual

Specify a list of features, which the filter will accept.

The filter mode will automatically be adjusted to show only these features (ShowFilteredList).

Parameters
idsThe 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.

Parameters
filterModeSets 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

Parameters
selectedOnTopSpecify, 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.

void QgsAttributeTableFilterModel::sort ( int  column,
Qt::SortOrder  order = Qt::AscendingOrder 
)
protectedvirtual

Sort by the given column using the given order.

Prefetches all the data from the layer to speed up sorting.

Parameters
columnThe column which should be sorted
orderThe order ( Qt::AscendingOrder or Qt::DescendingOrder )

Definition at line 94 of file qgsattributetablefiltermodel.cpp.


The documentation for this class was generated from the following files: