Skip to content
Permalink
Browse files
rename filters in map layer proxy model
  • Loading branch information
3nids committed May 12, 2014
1 parent afc2e05 commit 6765a7cd0ee28be3862c531ebe588ee360253a4d
Showing with 21 additions and 18 deletions.
  1. +9 −8 python/gui/qgsmaplayerproxymodel.sip
  2. +4 −3 src/gui/qgsmaplayerproxymodel.cpp
  3. +8 −7 src/gui/qgsmaplayerproxymodel.h
@@ -12,14 +12,15 @@ class QgsMapLayerProxyModel : QSortFilterProxyModel
public:
enum Filter
{
NoFilter = 1,
RasterLayer = 2,
NoGeometry = 4,
PointLayer = 8,
LineLayer = 16,
PolygonLayer = 32,
HasGeometry = 56,
VectorLayer = 60
RasterLayer = 1,
NoGeometry = 2,
PointLayer = 4,
LineLayer = 8,
PolygonLayer = 16,
HasGeometry = 28,
VectorLayer = 30,
PluginLayer = 32,
All = 63
};
typedef QFlags<QgsMapLayerProxyModel::Filter> Filters;

@@ -20,7 +20,7 @@

QgsMapLayerProxyModel::QgsMapLayerProxyModel( QObject *parent )
: QSortFilterProxyModel( parent )
, mFilters( NoFilter )
, mFilters( All )
, mModel( new QgsMapLayerModel( this ) )
{
setSourceModel( mModel );
@@ -34,7 +34,7 @@ QgsMapLayerProxyModel *QgsMapLayerProxyModel::setFilters( Filters filters )

bool QgsMapLayerProxyModel::filterAcceptsRow( int source_row, const QModelIndex &source_parent ) const
{
if ( mFilters.testFlag( NoFilter ) )
if ( mFilters.testFlag( All ) )
return true;

QModelIndex index = sourceModel()->index( source_row, 0, source_parent );
@@ -44,7 +44,8 @@ bool QgsMapLayerProxyModel::filterAcceptsRow( int source_row, const QModelIndex

// layer type
if (( mFilters.testFlag( RasterLayer ) && layer->type() == QgsMapLayer::RasterLayer ) ||
( mFilters.testFlag( VectorLayer ) && layer->type() == QgsMapLayer::VectorLayer ) )
( mFilters.testFlag( VectorLayer ) && layer->type() == QgsMapLayer::VectorLayer ) ||
( mFilters.testFlag( PluginLayer ) && layer->type() == QgsMapLayer::PluginLayer ) )
return true;

// geometry type
@@ -30,14 +30,15 @@ class GUI_EXPORT QgsMapLayerProxyModel : public QSortFilterProxyModel
public:
enum Filter
{
NoFilter = 1,
RasterLayer = 2,
NoGeometry = 4,
PointLayer = 8,
LineLayer = 16,
PolygonLayer = 32,
RasterLayer = 1,
NoGeometry = 2,
PointLayer = 4,
LineLayer = 8,
PolygonLayer = 16,
HasGeometry = PointLayer | LineLayer | PolygonLayer,
VectorLayer = NoGeometry | HasGeometry
VectorLayer = NoGeometry | HasGeometry,
PluginLayer = 32,
All = RasterLayer | PolygonLayer | PluginLayer
};
Q_DECLARE_FLAGS( Filters, Filter )

0 comments on commit 6765a7c

Please sign in to comment.