Skip to content

Commit

Permalink
Only show spatial layers in extent widget
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Jan 6, 2022
1 parent eae2000 commit 3cfdd2d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
3 changes: 2 additions & 1 deletion python/core/auto_generated/qgsmaplayerproxymodel.sip.in
Expand Up @@ -37,7 +37,8 @@ The :py:class:`QgsMapLayerProxyModel` class provides an easy to use model to dis
VectorTileLayer,
PointCloudLayer,
AnnotationLayer,
All
All,
SpatialLayer
};
typedef QFlags<QgsMapLayerProxyModel::Filter> Filters;

Expand Down
3 changes: 2 additions & 1 deletion src/core/qgsmaplayerproxymodel.h
Expand Up @@ -54,7 +54,8 @@ class CORE_EXPORT QgsMapLayerProxyModel : public QSortFilterProxyModel
VectorTileLayer = 256, //!< QgsVectorTileLayer \since QGIS 3.14
PointCloudLayer = 512, //!< QgsPointCloudLayer \since QGIS 3.18
AnnotationLayer = 1024, //!< QgsAnnotationLayer \since QGIS 3.22
All = RasterLayer | VectorLayer | PluginLayer | MeshLayer | VectorTileLayer | PointCloudLayer | AnnotationLayer
All = RasterLayer | VectorLayer | PluginLayer | MeshLayer | VectorTileLayer | PointCloudLayer | AnnotationLayer,
SpatialLayer = RasterLayer | HasGeometry | PluginLayer | MeshLayer | VectorTileLayer | PointCloudLayer | AnnotationLayer //!< \since QGIS 3.24
};
Q_DECLARE_FLAGS( Filters, Filter )
Q_FLAG( Filters )
Expand Down
4 changes: 3 additions & 1 deletion src/gui/qgsextentwidget.cpp
Expand Up @@ -19,6 +19,7 @@
#include "qgslogger.h"
#include "qgscoordinatetransform.h"
#include "qgsmapcanvas.h"
#include "qgsmaplayerproxymodel.h"
#include "qgsmaplayermodel.h"
#include "qgsexception.h"
#include "qgsproject.h"
Expand Down Expand Up @@ -51,7 +52,8 @@ QgsExtentWidget::QgsExtentWidget( QWidget *parent, WidgetStyle style )
mLayerMenu = new QMenu( tr( "Calculate from Layer" ), this );
mButtonCalcFromLayer->setMenu( mLayerMenu );
connect( mLayerMenu, &QMenu::aboutToShow, this, &QgsExtentWidget::layerMenuAboutToShow );
mMapLayerModel = new QgsMapLayerModel( this );
mMapLayerModel = new QgsMapLayerProxyModel( this );
mMapLayerModel->setFilters( QgsMapLayerProxyModel::Filter::SpatialLayer );

mLayoutMenu = new QMenu( tr( "Calculate from Layout Map" ), this );
mButtonCalcFromLayout->setMenu( mLayoutMenu );
Expand Down
4 changes: 2 additions & 2 deletions src/gui/qgsextentwidget.h
Expand Up @@ -32,7 +32,7 @@

class QgsBookmarkManagerProxyModel;
class QgsCoordinateReferenceSystem;
class QgsMapLayerModel;
class QgsMapLayerProxyModel;
class QgsMapLayer;

/**
Expand Down Expand Up @@ -272,7 +272,7 @@ class GUI_EXPORT QgsExtentWidget : public QWidget, private Ui::QgsExtentGroupBox
QMenu *mLayoutMenu = nullptr;
QMenu *mBookmarkMenu = nullptr;

QgsMapLayerModel *mMapLayerModel = nullptr;
QgsMapLayerProxyModel *mMapLayerModel = nullptr;
QgsBookmarkManagerProxyModel *mBookmarkModel = nullptr;

QList< QAction * > mLayerMenuActions;
Expand Down

0 comments on commit 3cfdd2d

Please sign in to comment.