Skip to content
Permalink
Browse files
Only show spatial layers in extent widget
  • Loading branch information
m-kuhn committed Jan 6, 2022
1 parent eae2000 commit 3cfdd2d8d76c311474caa74852cf49bce1fdf662
Showing with 9 additions and 5 deletions.
  1. +2 −1 python/core/auto_generated/qgsmaplayerproxymodel.sip.in
  2. +2 −1 src/core/qgsmaplayerproxymodel.h
  3. +3 −1 src/gui/qgsextentwidget.cpp
  4. +2 −2 src/gui/qgsextentwidget.h
@@ -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;

@@ -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 )
@@ -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"
@@ -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 );
@@ -32,7 +32,7 @@

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

/**
@@ -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;

0 comments on commit 3cfdd2d

Please sign in to comment.