QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
Public Slots | Signals | Public Member Functions | Protected Member Functions | List of all members
QgsProjectionSelectionTreeWidget Class Reference

A widget for selecting a coordinate reference system from a tree. More...

#include <qgsprojectionselectiontreewidget.h>

Inheritance diagram for QgsProjectionSelectionTreeWidget:
Inheritance graph
[legend]

Public Slots

void clearRecentCrs ()
 Clear the list of recent projections. More...
 
Q_DECL_DEPRECATED void pushProjectionToFront ()
 Marks the current selected projection for push to front of recent projections list. More...
 
void setCrs (const QgsCoordinateReferenceSystem &crs)
 Sets the initial crs to show within the dialog. More...
 
void setOgcWmsCrsFilter (const QSet< QString > &crsFilter)
 Filters this widget by the given CRSs. More...
 
void setPreviewRect (const QgsRectangle &rect)
 Sets the initial "preview" rectangle for the bounds overview map. More...
 

Signals

void crsSelected ()
 Emitted when a projection is selected in the widget. More...
 
void hasValidSelectionChanged (bool isValid)
 Emitted when the selection in the tree is changed from a valid selection to an invalid selection, or vice-versa. More...
 
Q_DECL_DEPRECATED void initialized ()
 Notifies others that the widget is now fully initialized, including deferred selection of projection. More...
 
void projectionDoubleClicked ()
 Emitted when a projection is double clicked in the list. More...
 

Public Member Functions

 QgsProjectionSelectionTreeWidget (QWidget *parent=nullptr, QgsCoordinateReferenceSystemProxyModel::Filters filters=QgsCoordinateReferenceSystemProxyModel::FilterHorizontal|QgsCoordinateReferenceSystemProxyModel::FilterCompound)
 Constructor for QgsProjectionSelectionTreeWidget, with the specified parent widget. More...
 
 ~QgsProjectionSelectionTreeWidget () override
 
QgsCoordinateReferenceSystem crs () const
 Returns the CRS currently selected in the widget. More...
 
QgsCoordinateReferenceSystemProxyModel::Filters filters () const
 Returns the filters set on the available CRS. More...
 
bool hasValidSelection () const
 Returns true if the current selection in the widget is a valid choice. More...
 
QgsRectangle previewRect () const
 The initial "preview" rectangle for the bounds overview map. More...
 
void setFilters (QgsCoordinateReferenceSystemProxyModel::Filters filters)
 Sets filters for the available CRS. More...
 
void setNotSetText (const QString &text)
 Sets the text to show for the not set option. More...
 
void setShowBoundsMap (bool show)
 Sets whether to show the bounds preview map. More...
 
void setShowNoProjection (bool show)
 Sets whether a "no/invalid" projection option should be shown. More...
 
bool showBoundsMap () const
 Returns whether the bounds preview map is shown. More...
 
bool showNoProjection () const
 Returns whether the "no/invalid" projection option is shown. More...
 

Protected Member Functions

bool eventFilter (QObject *obj, QEvent *ev) override
 
void resizeEvent (QResizeEvent *event) override
 

Detailed Description

A widget for selecting a coordinate reference system from a tree.

This widget implements a tree view of projections, as seen in the QgsProjectionSelectionDialog dialog. In most cases it is more suitable to use the compact QgsProjectionSelectionWidget widget.

See also
QgsProjectionSelectionDialog.
QgsProjectionSelectionWidget

Definition at line 74 of file qgsprojectionselectiontreewidget.h.

Constructor & Destructor Documentation

◆ QgsProjectionSelectionTreeWidget()

QgsProjectionSelectionTreeWidget::QgsProjectionSelectionTreeWidget ( QWidget *  parent = nullptr,
QgsCoordinateReferenceSystemProxyModel::Filters  filters = QgsCoordinateReferenceSystemProxyModel::FilterHorizontal | QgsCoordinateReferenceSystemProxyModel::FilterCompound 
)

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.

Definition at line 43 of file qgsprojectionselectiontreewidget.cpp.

◆ ~QgsProjectionSelectionTreeWidget()

QgsProjectionSelectionTreeWidget::~QgsProjectionSelectionTreeWidget ( )
override

Definition at line 151 of file qgsprojectionselectiontreewidget.cpp.

Member Function Documentation

◆ clearRecentCrs

void QgsProjectionSelectionTreeWidget::clearRecentCrs ( )
slot

Clear the list of recent projections.

Since
QGIS 3.32

Definition at line 569 of file qgsprojectionselectiontreewidget.cpp.

◆ crs()

QgsCoordinateReferenceSystem QgsProjectionSelectionTreeWidget::crs ( ) const

Returns the CRS currently selected in the widget.

See also
setCrs()

Definition at line 265 of file qgsprojectionselectiontreewidget.cpp.

◆ crsSelected

void QgsProjectionSelectionTreeWidget::crsSelected ( )
signal

Emitted when a projection is selected in the widget.

◆ eventFilter()

bool QgsProjectionSelectionTreeWidget::eventFilter ( QObject *  obj,
QEvent *  ev 
)
overrideprotected

Definition at line 172 of file qgsprojectionselectiontreewidget.cpp.

◆ filters()

QgsCoordinateReferenceSystemProxyModel::Filters QgsProjectionSelectionTreeWidget::filters ( ) const

Returns the filters set on the available CRS.

See also
setFilters()
Since
QGIS 3.34

Definition at line 249 of file qgsprojectionselectiontreewidget.cpp.

◆ hasValidSelection()

bool QgsProjectionSelectionTreeWidget::hasValidSelection ( ) const

Returns true if the current selection in the widget is a valid choice.

Valid selections include any projection and also the "no/invalid projection" option (if setShowNoProjection() was called). Invalid selections are the group headers (such as "Geographic Coordinate Systems")

Definition at line 322 of file qgsprojectionselectiontreewidget.cpp.

◆ hasValidSelectionChanged

void QgsProjectionSelectionTreeWidget::hasValidSelectionChanged ( bool  isValid)
signal

Emitted when the selection in the tree is changed from a valid selection to an invalid selection, or vice-versa.

Since
QGIS 3.18

◆ initialized

Q_DECL_DEPRECATED void QgsProjectionSelectionTreeWidget::initialized ( )
signal

Notifies others that the widget is now fully initialized, including deferred selection of projection.

Deprecated:
no longer emitted

◆ previewRect()

QgsRectangle QgsProjectionSelectionTreeWidget::previewRect ( ) const

The initial "preview" rectangle for the bounds overview map.

See also
previewRect()

Definition at line 244 of file qgsprojectionselectiontreewidget.cpp.

◆ projectionDoubleClicked

void QgsProjectionSelectionTreeWidget::projectionDoubleClicked ( )
signal

Emitted when a projection is double clicked in the list.

◆ pushProjectionToFront

void QgsProjectionSelectionTreeWidget::pushProjectionToFront ( )
slot

Marks the current selected projection for push to front of recent projections list.

Deprecated:
Has no effect since QGIS 3.20

Definition at line 475 of file qgsprojectionselectiontreewidget.cpp.

◆ resizeEvent()

void QgsProjectionSelectionTreeWidget::resizeEvent ( QResizeEvent *  event)
overrideprotected

Definition at line 162 of file qgsprojectionselectiontreewidget.cpp.

◆ setCrs

void QgsProjectionSelectionTreeWidget::setCrs ( const QgsCoordinateReferenceSystem crs)
slot

Sets the initial crs to show within the dialog.

See also
crs()

Definition at line 213 of file qgsprojectionselectiontreewidget.cpp.

◆ setFilters()

void QgsProjectionSelectionTreeWidget::setFilters ( QgsCoordinateReferenceSystemProxyModel::Filters  filters)

Sets filters for the available CRS.

See also
filters()
Since
QGIS 3.34

Definition at line 254 of file qgsprojectionselectiontreewidget.cpp.

◆ setNotSetText()

void QgsProjectionSelectionTreeWidget::setNotSetText ( const QString &  text)

Sets the text to show for the not set option.

Note that this option is not shown by default and must be set visible by calling setShowNoProjection().

Since
QGIS 3.16

Definition at line 312 of file qgsprojectionselectiontreewidget.cpp.

◆ setOgcWmsCrsFilter

void QgsProjectionSelectionTreeWidget::setOgcWmsCrsFilter ( const QSet< QString > &  crsFilter)
slot

Filters this widget by the given CRSs.

Sets this widget to filter the available projections to those listed by the given Coordinate Reference Systems.

Parameters
crsFiltera list of the authority:id strings for Coordinate Reference Systems to include in the widget.

Definition at line 338 of file qgsprojectionselectiontreewidget.cpp.

◆ setPreviewRect

void QgsProjectionSelectionTreeWidget::setPreviewRect ( const QgsRectangle rect)
slot

Sets the initial "preview" rectangle for the bounds overview map.

See also
previewRect()

Definition at line 239 of file qgsprojectionselectiontreewidget.cpp.

◆ setShowBoundsMap()

void QgsProjectionSelectionTreeWidget::setShowBoundsMap ( bool  show)

Sets whether to show the bounds preview map.

See also
showBoundsMap()

Definition at line 301 of file qgsprojectionselectiontreewidget.cpp.

◆ setShowNoProjection()

void QgsProjectionSelectionTreeWidget::setShowNoProjection ( bool  show)

Sets whether a "no/invalid" projection option should be shown.

If this option is selected, calling crs() will return an invalid QgsCoordinateReferenceSystem.

See also
showNoProjection()

Definition at line 291 of file qgsprojectionselectiontreewidget.cpp.

◆ showBoundsMap()

bool QgsProjectionSelectionTreeWidget::showBoundsMap ( ) const

Returns whether the bounds preview map is shown.

See also
setShowBoundsMap()

Definition at line 317 of file qgsprojectionselectiontreewidget.cpp.

◆ showNoProjection()

bool QgsProjectionSelectionTreeWidget::showNoProjection ( ) const

Returns whether the "no/invalid" projection option is shown.

If this option is selected, calling crs() will return an invalid QgsCoordinateReferenceSystem.

See also
setShowNoProjection()

Definition at line 307 of file qgsprojectionselectiontreewidget.cpp.


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