QGIS API Documentation  3.2.0-Bonn (bc43194)
Public Types | Public Member Functions | Properties | List of all members
QgsMapLayerProxyModel Class Reference

The QgsMapLayerProxyModel class provides an easy to use model to display the list of layers in widgets. More...

#include <qgsmaplayerproxymodel.h>

Inheritance diagram for QgsMapLayerProxyModel:
Inheritance graph
[legend]

Public Types

enum  Filter {
  RasterLayer = 1, NoGeometry = 2, PointLayer = 4, LineLayer = 8,
  PolygonLayer = 16, HasGeometry = PointLayer | LineLayer | PolygonLayer, VectorLayer = NoGeometry | HasGeometry, PluginLayer = 32,
  WritableLayer = 64, All = RasterLayer | VectorLayer | PluginLayer
}
 

Public Member Functions

 QgsMapLayerProxyModel (QObject *parent=nullptr)
 QgsMapLayerProxModel creates a proxy model with a QgsMapLayerModel as source model. More...
 
QStringList exceptedLayerIds () const
 Gets the list of maplayer ids which are excluded from the list. More...
 
QList< QgsMapLayer * > exceptedLayerList ()
 Gets the list of maplayers which are excluded from the list. More...
 
QStringList excludedProviders () const
 Returns the list of data providers which are excluded from the model. More...
 
bool filterAcceptsRow (int source_row, const QModelIndex &source_parent) const override
 
const Filters & filters () const
 
bool lessThan (const QModelIndex &left, const QModelIndex &right) const override
 
void setExceptedLayerIds (const QStringList &ids)
 Sets the list of maplayer ids which are excluded from the list. More...
 
void setExceptedLayerList (const QList< QgsMapLayer *> &exceptList)
 offer the possibility to except some layers to be listed More...
 
void setExcludedProviders (const QStringList &providers)
 Sets a list of data providers which should be excluded from the model. More...
 
QgsMapLayerProxyModelsetFilters (QgsMapLayerProxyModel::Filters filters)
 setFilters set flags that affect how layers are filtered More...
 
QgsMapLayerModelsourceLayerModel () const
 layerModel returns the QgsMapLayerModel used in this QSortFilterProxyModel More...
 

Properties

QStringList exceptedLayerIds
 
QList< QgsMapLayer * > exceptedLayerList
 
QgsMapLayerProxyModel::Filters filters
 

Detailed Description

The QgsMapLayerProxyModel class provides an easy to use model to display the list of layers in widgets.

Since
QGIS 2.3

Definition at line 33 of file qgsmaplayerproxymodel.h.

Member Enumeration Documentation

◆ Filter

Enumerator
RasterLayer 
NoGeometry 
PointLayer 
LineLayer 
PolygonLayer 
HasGeometry 
VectorLayer 
PluginLayer 
WritableLayer 
All 

Definition at line 42 of file qgsmaplayerproxymodel.h.

Constructor & Destructor Documentation

◆ QgsMapLayerProxyModel()

QgsMapLayerProxyModel::QgsMapLayerProxyModel ( QObject *  parent = nullptr)
explicit

QgsMapLayerProxModel creates a proxy model with a QgsMapLayerModel as source model.

It can be used to filter the layers list in a widget.

Definition at line 25 of file qgsmaplayerproxymodel.cpp.

Member Function Documentation

◆ exceptedLayerIds()

QStringList QgsMapLayerProxyModel::exceptedLayerIds ( ) const

Gets the list of maplayer ids which are excluded from the list.

◆ exceptedLayerList()

QList<QgsMapLayer *> QgsMapLayerProxyModel::exceptedLayerList ( )
inline

Gets the list of maplayers which are excluded from the list.

Definition at line 80 of file qgsmaplayerproxymodel.h.

◆ excludedProviders()

QStringList QgsMapLayerProxyModel::excludedProviders ( ) const
inline

Returns the list of data providers which are excluded from the model.

See also
setExcludedProviders()
Since
QGIS 3.0

Definition at line 99 of file qgsmaplayerproxymodel.h.

◆ filterAcceptsRow()

bool QgsMapLayerProxyModel::filterAcceptsRow ( int  source_row,
const QModelIndex &  source_parent 
) const
override

Definition at line 83 of file qgsmaplayerproxymodel.cpp.

◆ filters()

const Filters& QgsMapLayerProxyModel::filters ( ) const
inline

Definition at line 75 of file qgsmaplayerproxymodel.h.

◆ lessThan()

bool QgsMapLayerProxyModel::lessThan ( const QModelIndex &  left,
const QModelIndex &  right 
) const
override

Definition at line 139 of file qgsmaplayerproxymodel.cpp.

◆ setExceptedLayerIds()

void QgsMapLayerProxyModel::setExceptedLayerIds ( const QStringList &  ids)

Sets the list of maplayer ids which are excluded from the list.

Definition at line 54 of file qgsmaplayerproxymodel.cpp.

◆ setExceptedLayerList()

void QgsMapLayerProxyModel::setExceptedLayerList ( const QList< QgsMapLayer *> &  exceptList)

offer the possibility to except some layers to be listed

Definition at line 45 of file qgsmaplayerproxymodel.cpp.

◆ setExcludedProviders()

void QgsMapLayerProxyModel::setExcludedProviders ( const QStringList &  providers)

Sets a list of data providers which should be excluded from the model.

See also
excludedProviders()
Since
QGIS 3.0

Definition at line 77 of file qgsmaplayerproxymodel.cpp.

◆ setFilters()

QgsMapLayerProxyModel * QgsMapLayerProxyModel::setFilters ( QgsMapLayerProxyModel::Filters  filters)

setFilters set flags that affect how layers are filtered

Parameters
filtersare Filter flags
Since
QGIS 2.3

Definition at line 38 of file qgsmaplayerproxymodel.cpp.

◆ sourceLayerModel()

QgsMapLayerModel* QgsMapLayerProxyModel::sourceLayerModel ( ) const
inline

layerModel returns the QgsMapLayerModel used in this QSortFilterProxyModel

Definition at line 67 of file qgsmaplayerproxymodel.h.

Property Documentation

◆ exceptedLayerIds

QStringList QgsMapLayerProxyModel::exceptedLayerIds
readwrite

Definition at line 39 of file qgsmaplayerproxymodel.h.

◆ exceptedLayerList

QList<QgsMapLayer *> QgsMapLayerProxyModel::exceptedLayerList
readwrite

Definition at line 38 of file qgsmaplayerproxymodel.h.

◆ filters

QgsMapLayerProxyModel::Filters QgsMapLayerProxyModel::filters
readwrite

Definition at line 37 of file qgsmaplayerproxymodel.h.


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