QgsProjectionSelectionTreeWidget class

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.

Constructors, destructors, conversion operators

QgsProjectionSelectionTreeWidget(QWidget* parent = nullptr)
Constructor for QgsProjectionSelectionTreeWidget.

Public functions

auto crs() const -> QgsCoordinateReferenceSystem
Returns the CRS currently selected in the widget.
auto hasValidSelection() const -> bool
Returns true if the current selection in the widget is a valid choice.
void setShowBoundsMap(bool show)
Sets whether to show the bounnds preview map.
void setShowNoProjection(bool show)
Sets whether a "no/invalid" projection option should be shown.
auto showBoundsMap() const -> bool
Returns whether the bounds preview map is shown.
auto showNoProjection() const -> bool
Returns whether the "no/invalid" projection option is shown.

Signals

void crsSelected()
Emitted when a projection is selected in the widget.
void initialized()
Notifies others that the widget is now fully initialized, including deferred selection of projection.
void projectionDoubleClicked()
Emitted when a projection is double clicked in the list.

Public slots

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

Function documentation

QgsCoordinateReferenceSystem QgsProjectionSelectionTreeWidget::crs() const

Returns the CRS currently selected in the widget.

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"

void QgsProjectionSelectionTreeWidget::setShowBoundsMap(bool show)

Sets whether to show the bounnds preview map.

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.

bool QgsProjectionSelectionTreeWidget::showBoundsMap() const

Returns whether the bounds preview map is shown.

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.

void QgsProjectionSelectionTreeWidget::initialized() signal

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

void QgsProjectionSelectionTreeWidget::projectionDoubleClicked() signal

Emitted when a projection is double clicked in the list.

QgsRectangle QgsProjectionSelectionTreeWidget::previewRect() const public slot

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

void QgsProjectionSelectionTreeWidget::setCrs(const QgsCoordinateReferenceSystem& crs) public slot

Sets the initial crs to show within the dialog.

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

filters this widget by the given CRSs

Parameters
crsFilter a list of OGC Coordinate Reference Systems to filter the list of projections by. This is useful in (e.g.) WMS situations where you just want to offer what the WMS server can support.

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

void QgsProjectionSelectionTreeWidget::setPreviewRect(const QgsRectangle& rect) public slot

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