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 an inline panel. |
|
- 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
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)
- crs(self) QgsCoordinateReferenceSystem[source]¶
Returns the CRS currently selected in the widget.
See also
- Return type:
- signal crsChanged[source]¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- signal crsDoubleClicked[source]¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- 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
Trueif the widget has a valid CRS defined.- Return type:
bool
- signal hasValidSelectionChanged[source]¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- setCrs(self, crs: QgsCoordinateReferenceSystem)[source]¶
Sets the
crsto show within the widget.See also
- Parameters:
- 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])
- setMessage(self, message: str | None)[source]¶
Sets a
messageto 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
descriptionargument 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