Class: QgsCrsSelectionWidget¶
A generic widget allowing users to pick a Coordinate Reference System (or define their own).
Added in version 3.24.

QgsCrsSelectionWidget¶
Class Hierarchy¶
Base classes¶
Base class for any widget that can be shown as a inline panel |
|
Methods
Returns the CRS currently selected in the widget. |
|
Returns the filters set on the available CRS. |
|
Returns |
|
Sets the crs to show within the widget. |
|
Sets filters for the available CRS. |
|
Sets a message to show in the dialog. |
|
Sets the text to show for the not set option. |
|
filters this dialog by the given CRSs |
|
Sets whether a "no/invalid" CRS option should be shown. |
|
Returns whether the "no/invalid" CRS option is shown. |
Signals
Emitted when the CRS defined in the widget is changed. |
|
Emitted when a CRS entry in the widget is double-clicked. |
|
Emitted when the widget has a valid selection or not. |
- class qgis.gui.QgsCrsSelectionWidget[source]¶
Bases:
QgsPanelWidget
- __init__(parent: QWidget | None = None, filters: QgsCoordinateReferenceSystemProxyModel.Filters | QgsCoordinateReferenceSystemProxyModel.Filter = QgsCoordinateReferenceSystemProxyModel.FilterHorizontal | QgsCoordinateReferenceSystemProxyModel.FilterCompound)
Constructor for QgsCrsSelectionWidget, with the specified
parent
widget.Since QGIS 3.36, 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. Thefilter
can be altered to also include vertical CRS if desired.- Parameters:
parent (Optional[QWidget] = None)
filters (Union[QgsCoordinateReferenceSystemProxyModel.Filters, QgsCoordinateReferenceSystemProxyModel.Filter] = QgsCoordinateReferenceSystemProxyModel.FilterHorizontal|QgsCoordinateReferenceSystemProxyModel.FilterCompound)
- crs(self) QgsCoordinateReferenceSystem [source]¶
Returns the CRS currently selected in the widget.
See also
- Return type:
- signal crsDoubleClicked(crs: QgsCoordinateReferenceSystem)[source]¶
Emitted when a CRS entry in the widget is double-clicked.
- Parameters:
- filters(self) QgsCoordinateReferenceSystemProxyModel.Filters [source]¶
Returns the filters set on the available CRS.
See also
Added in version 3.36.
- Return type:
- hasValidSelection(self) bool [source]¶
Returns
True
if the widget has a valid CRS defined.- Return type:
bool
- signal hasValidSelectionChanged(isValid: bool)[source]¶
Emitted when the widget has a valid selection or not.
- Parameters:
isValid (bool)
- setCrs(self, crs: QgsCoordinateReferenceSystem)[source]¶
Sets the
crs
to show within the widget.See also
- Parameters:
- setFilters(self, filters: QgsCoordinateReferenceSystemProxyModel.Filters | QgsCoordinateReferenceSystemProxyModel.Filter)[source]¶
Sets
filters
for the available CRS.See also
Added in version 3.36.
- Parameters:
filters (Union[QgsCoordinateReferenceSystemProxyModel.Filters, QgsCoordinateReferenceSystemProxyModel.Filter])
- setMessage(self, message: str | None)[source]¶
Sets a
message
to show in the dialog.- Parameters:
message (Optional[str])
- setNotSetText(self, text: str | None, description: str | None = '')[source]¶
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
setShowNoCrs()
.The
description
argument can be used to specify a detailed description which is shown when the option is selected.- Parameters:
text (Optional[str])
description (Optional[str] = '')
- setOgcWmsCrsFilter(self, crsFilter: Iterable[str | None])[source]¶
filters this dialog by the given CRSs
Sets this dialog to filter the available CRSs to those listed by the given Coordinate Reference Systems.
- Parameters:
crsFilter (Iterable[Optional[str]]) – a list of OGC Coordinate Reference Systems to filter the list of CRS by. This is useful in (e.g.) WMS situations where you just want to offer what the WMS server can support.
Warning
This function’s behavior is undefined if it is called after the dialog is shown.
- setShowNoCrs(self, show: bool)[source]¶
Sets whether a “no/invalid” CRS option should be shown. If this option is selected, calling
crs()
will return an invalidQgsCoordinateReferenceSystem
.See also
- Parameters:
show (bool)
- showNoCrs(self) bool [source]¶
Returns whether the “no/invalid” CRS option is shown. If this option is selected, calling
crs()
will return an invalidQgsCoordinateReferenceSystem
.See also
- Return type:
bool