Class: QgsProjectionSelectionWidget¶
A widget for selecting a projection.
QgsProjectionSelectionWidget¶
Class Hierarchy¶
Base classes¶
Methods
Returns the currently selected CRS for the widget |
|
Returns the title for the CRS selector dialog window. |
|
Returns the filters set on the available CRS. |
|
Returns whether the specified CRS option is visible in the widget. |
|
Opens the dialog for selecting a new CRS |
|
Sets the current CRS for the widget |
|
Sets the title for the CRS selector dialog window. |
|
Sets a filtered list of CRSes to show in the widget. |
|
Sets filters for the available CRS. |
|
Sets the layer CRS for the widget. |
|
Sets a message to show in the dialog. |
|
Sets the text to show for the not set option. |
|
Sets whether a predefined CRS option should be shown in the widget. |
|
Sets whether the widget will show warnings to users when they select a CRS which has low accuracy. |
|
Sets the original source ensemble datum name. |
|
Returns |
|
Returns the original source ensemble datum name. |
Signals
Emitted when the not set option is selected. |
|
Emitted when the selected CRS is changed |
Attributes
- class qgis.gui.QgsProjectionSelectionWidget[source]¶
Bases:
QWidget- __init__(parent: QWidget | None = None, filters: QgsCoordinateReferenceSystemProxyModel.Filters | QgsCoordinateReferenceSystemProxyModel.Filter = QgsCoordinateReferenceSystemProxyModel.FilterHorizontal | QgsCoordinateReferenceSystemProxyModel.FilterCompound)
Constructor for QgsProjectionSelectionWidget, with the specified
parentwidget.Since QGIS 3.36, the optional
filterargument 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. Thefiltercan be altered to also include vertical CRS if desired.- Parameters:
parent (Optional[QWidget] = None)
filters (Union[QgsCoordinateReferenceSystemProxyModel.Filters, QgsCoordinateReferenceSystemProxyModel.Filter] = QgsCoordinateReferenceSystemProxyModel.FilterHorizontal|QgsCoordinateReferenceSystemProxyModel.FilterCompound)
- CrsNotSet = 64¶
- class CrsOption¶
Bases:
int
- CurrentCrs = 8¶
- DefaultCrs = 16¶
- Invalid = 1¶
- LayerCrs = 2¶
- ProjectCrs = 4¶
- RecentCrs = 32¶
- crs(self) QgsCoordinateReferenceSystem[source]¶
Returns the currently selected CRS for the widget
- Return type:
- Returns:
current CRS
- signal crsChanged(crs: QgsCoordinateReferenceSystem)[source]¶
Emitted when the selected CRS is changed
- Parameters:
- dialogTitle(self) str[source]¶
Returns the title for the CRS selector dialog window.
See also
Added in version 3.24.
- Return type:
str
- filters(self) QgsCoordinateReferenceSystemProxyModel.Filters[source]¶
Returns the filters set on the available CRS.
See also
Added in version 3.36.
- Return type:
- optionVisible(self, option: QgsProjectionSelectionWidget.CrsOption) bool[source]¶
Returns whether the specified CRS option is visible in the widget.
See also
- Parameters:
- Return type:
bool
- setCrs(self, crs: QgsCoordinateReferenceSystem)[source]¶
Sets the current CRS for the widget
- Parameters:
crs (QgsCoordinateReferenceSystem) – new CRS
- setDialogTitle(self, title: str | None)[source]¶
Sets the
titlefor the CRS selector dialog window.See also
Added in version 3.24.
- Parameters:
title (Optional[str])
- setFilter(self, crses: Iterable[QgsCoordinateReferenceSystem])[source]¶
Sets a filtered list of CRSes to show in the widget.
Added in version 3.28.
- Parameters:
crses (Iterable[QgsCoordinateReferenceSystem])
- setFilters(self, filters: QgsCoordinateReferenceSystemProxyModel.Filters | QgsCoordinateReferenceSystemProxyModel.Filter)[source]¶
Sets
filtersfor the available CRS.See also
Added in version 3.36.
- Parameters:
filters (Union[QgsCoordinateReferenceSystemProxyModel.Filters, QgsCoordinateReferenceSystemProxyModel.Filter])
- setLayerCrs(self, crs: QgsCoordinateReferenceSystem)[source]¶
Sets the layer CRS for the widget. If set, this will be added as an option to the preset CRSes shown in the widget.
- Parameters:
crs (QgsCoordinateReferenceSystem) – layer CRS
- setMessage(self, text: str | None)[source]¶
Sets a
messageto show in the dialog. If an empty string is passed, the message will be a generic ‘define the CRS for this layer’.- Parameters:
text (Optional[str])
- setNotSetText(self, text: 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
setOptionVisible().- Parameters:
text (Optional[str])
- setOptionVisible(self, option: QgsProjectionSelectionWidget.CrsOption, visible: bool)[source]¶
Sets whether a predefined CRS option should be shown in the widget.
- Parameters:
option (QgsProjectionSelectionWidget.CrsOption) – CRS option to show/hide
visible (bool) – whether the option should be shown
See also
- setShowAccuracyWarnings(self, show: bool)[source]¶
Sets whether the widget will
showwarnings to users when they select a CRS which has low accuracy.See also
Added in version 3.20.
- Parameters:
show (bool)
- setSourceEnsemble(self, ensemble: str | None)[source]¶
Sets the original source
ensembledatum name.If set, CRS accuracy warnings will not be shown when the selected CRS in the widget has a matching ensemble datum, regardless of the ensemble’s accuracy.
See also
Added in version 3.20.
- Parameters:
ensemble (Optional[str])
- showAccuracyWarnings(self) bool[source]¶
Returns
Trueif the widget will show a warning to users when they select a CRS which has low accuracy.See also
Added in version 3.20.
- Return type:
bool