mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
By default, QgsProjectionSelectionTreeWidget should only
show horizontal (and compound) CRS in order to match behavior of older releases But allow opt in filters for display of vertical crs
This commit is contained in:
parent
ef6057aadd
commit
8c91e8fa97
@ -172,6 +172,9 @@ Returns whether deprecated CRS will be filtered from the results.
|
||||
|
||||
};
|
||||
|
||||
QFlags<QgsCoordinateReferenceSystemProxyModel::Filter> operator|(QgsCoordinateReferenceSystemProxyModel::Filter f1, QFlags<QgsCoordinateReferenceSystemProxyModel::Filter> f2);
|
||||
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* This file has been generated automatically from *
|
||||
|
@ -32,9 +32,14 @@ suitable to use the compact :py:class:`QgsProjectionSelectionWidget` widget.
|
||||
%End
|
||||
public:
|
||||
|
||||
QgsProjectionSelectionTreeWidget( QWidget *parent /TransferThis/ = 0 );
|
||||
QgsProjectionSelectionTreeWidget( QWidget *parent /TransferThis/ = 0,
|
||||
QgsCoordinateReferenceSystemProxyModel::Filters filters = QgsCoordinateReferenceSystemProxyModel::FilterHorizontal | QgsCoordinateReferenceSystemProxyModel::FilterCompound );
|
||||
%Docstring
|
||||
Constructor for QgsProjectionSelectionTreeWidget.
|
||||
Constructor for QgsProjectionSelectionTreeWidget, with the specified ``parent`` widget.
|
||||
|
||||
Since QGIS 3.34, the optional ``filter`` argument can be used to specify filters on the systems
|
||||
shown in the widget. The default is to show all horizontal and compound CRS in order to match
|
||||
the behavior of older QGIS releases. The ``filter`` can be altered to also include vertical CRS if desired.
|
||||
%End
|
||||
|
||||
~QgsProjectionSelectionTreeWidget();
|
||||
@ -109,6 +114,24 @@ The initial "preview" rectangle for the bounds overview map.
|
||||
.. seealso:: :py:func:`previewRect`
|
||||
|
||||
.. versionadded:: 3.0
|
||||
%End
|
||||
|
||||
QgsCoordinateReferenceSystemProxyModel::Filters filters() const;
|
||||
%Docstring
|
||||
Returns the filters set on the available CRS.
|
||||
|
||||
.. seealso:: :py:func:`setFilters`
|
||||
|
||||
.. versionadded:: 3.34
|
||||
%End
|
||||
|
||||
void setFilters( QgsCoordinateReferenceSystemProxyModel::Filters filters );
|
||||
%Docstring
|
||||
Sets ``filters`` for the available CRS.
|
||||
|
||||
.. seealso:: :py:func:`filters`
|
||||
|
||||
.. versionadded:: 3.34
|
||||
%End
|
||||
|
||||
public slots:
|
||||
|
@ -397,5 +397,7 @@ class GUI_EXPORT QgsCoordinateReferenceSystemProxyModel: public QSortFilterProxy
|
||||
Filters mFilters = Filters();
|
||||
};
|
||||
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS( QgsCoordinateReferenceSystemProxyModel::Filters )
|
||||
|
||||
|
||||
#endif // QGSCOORDINATEREFERENCESYSTEMMODEL_H
|
||||
|
@ -36,12 +36,14 @@
|
||||
#include <QMessageBox>
|
||||
#include <QRegularExpression>
|
||||
|
||||
QgsProjectionSelectionTreeWidget::QgsProjectionSelectionTreeWidget( QWidget *parent )
|
||||
QgsProjectionSelectionTreeWidget::QgsProjectionSelectionTreeWidget( QWidget *parent, QgsCoordinateReferenceSystemProxyModel::Filters filters )
|
||||
: QWidget( parent )
|
||||
{
|
||||
setupUi( this );
|
||||
|
||||
mCrsModel = new QgsCoordinateReferenceSystemProxyModel( this );
|
||||
mCrsModel->setFilters( filters );
|
||||
|
||||
lstCoordinateSystems->setModel( mCrsModel );
|
||||
lstCoordinateSystems->setSelectionBehavior( QAbstractItemView::SelectRows );
|
||||
|
||||
@ -253,6 +255,16 @@ QgsRectangle QgsProjectionSelectionTreeWidget::previewRect() const
|
||||
return mAreaCanvas->canvasRect();
|
||||
}
|
||||
|
||||
QgsCoordinateReferenceSystemProxyModel::Filters QgsProjectionSelectionTreeWidget::filters() const
|
||||
{
|
||||
return mCrsModel->filters();
|
||||
}
|
||||
|
||||
void QgsProjectionSelectionTreeWidget::setFilters( QgsCoordinateReferenceSystemProxyModel::Filters filters )
|
||||
{
|
||||
mCrsModel->setFilters( filters );
|
||||
}
|
||||
|
||||
QgsCoordinateReferenceSystem QgsProjectionSelectionTreeWidget::crs() const
|
||||
{
|
||||
if ( mCheckBoxNoProjection->isEnabled() && mCheckBoxNoProjection->isChecked() )
|
||||
|
@ -19,9 +19,9 @@
|
||||
#include "qgis_sip.h"
|
||||
#include "qgis_gui.h"
|
||||
#include "qgscoordinatereferencesystem.h"
|
||||
#include "qgscoordinatereferencesystemmodel.h"
|
||||
|
||||
class QResizeEvent;
|
||||
class QgsCoordinateReferenceSystemProxyModel;
|
||||
|
||||
/**
|
||||
* \class QgsProjectionSelectionTreeWidget
|
||||
@ -44,9 +44,14 @@ class GUI_EXPORT QgsProjectionSelectionTreeWidget : public QWidget, private Ui::
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructor for QgsProjectionSelectionTreeWidget.
|
||||
* Constructor for QgsProjectionSelectionTreeWidget, with the specified \a parent widget.
|
||||
*
|
||||
* Since QGIS 3.34, the optional \a filter argument can be used to specify filters on the systems
|
||||
* shown in the widget. The default is to show all horizontal and compound CRS in order to match
|
||||
* the behavior of older QGIS releases. The \a filter can be altered to also include vertical CRS if desired.
|
||||
*/
|
||||
QgsProjectionSelectionTreeWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr );
|
||||
QgsProjectionSelectionTreeWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr,
|
||||
QgsCoordinateReferenceSystemProxyModel::Filters filters = QgsCoordinateReferenceSystemProxyModel::FilterHorizontal | QgsCoordinateReferenceSystemProxyModel::FilterCompound );
|
||||
|
||||
~QgsProjectionSelectionTreeWidget() override;
|
||||
|
||||
@ -109,6 +114,22 @@ class GUI_EXPORT QgsProjectionSelectionTreeWidget : public QWidget, private Ui::
|
||||
*/
|
||||
QgsRectangle previewRect() const;
|
||||
|
||||
/**
|
||||
* Returns the filters set on the available CRS.
|
||||
*
|
||||
* \see setFilters()
|
||||
* \since QGIS 3.34
|
||||
*/
|
||||
QgsCoordinateReferenceSystemProxyModel::Filters filters() const;
|
||||
|
||||
/**
|
||||
* Sets \a filters for the available CRS.
|
||||
*
|
||||
* \see filters()
|
||||
* \since QGIS 3.34
|
||||
*/
|
||||
void setFilters( QgsCoordinateReferenceSystemProxyModel::Filters filters );
|
||||
|
||||
public slots:
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user