Class: QgsCrsSelectionWidget

class qgis.gui.QgsCrsSelectionWidget

Bases: QgsPanelWidget

A generic widget allowing users to pick a Coordinate Reference System (or define their own).

New in version 3.24.

QgsCrsSelectionWidget(parent: QWidget = None, filters: Union[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. The filter can be altered to also include vertical CRS if desired.

Methods

actionEvent

changeEvent

childEvent

closeEvent

connectNotify

contextMenuEvent

create

crs

Returns the CRS currently selected in the widget.

customEvent

destroy

disconnectNotify

dragEnterEvent

dragLeaveEvent

dragMoveEvent

dropEvent

enterEvent

event

filters

Returns the filters set on the available CRS.

focusInEvent

focusNextChild

focusNextPrevChild

focusOutEvent

focusPreviousChild

hasValidSelection

Returns True if the widget has a valid CRS defined.

hideEvent

initPainter

inputMethodEvent

isSignalConnected

keyPressEvent

Overridden key press event to handle the esc event on the widget.

keyReleaseEvent

leaveEvent

metric

mouseDoubleClickEvent

mouseMoveEvent

mousePressEvent

mouseReleaseEvent

moveEvent

nativeEvent

paintEvent

receivers

resizeEvent

sender

senderSignalIndex

setCrs

Sets the crs to show within the widget.

setFilters

Sets filters for the available CRS.

setMessage

Sets a message to show in the dialog.

setNotSetText

Sets the text to show for the not set option.

setOgcWmsCrsFilter

filters this dialog by the given CRSs

setShowNoCrs

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

sharedPainter

showEvent

showNoCrs

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

tabletEvent

timerEvent

updateMicroFocus

wheelEvent

Signals

crsChanged

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

crsDoubleClicked

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

hasValidSelectionChanged

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

actionEvent(self, QActionEvent)
changeEvent(self, QEvent)
childEvent(self, QChildEvent)
closeEvent(self, QCloseEvent)
connectNotify(self, QMetaMethod)
contextMenuEvent(self, QContextMenuEvent)
create(self, window: PyQt5.sip.voidptr = 0, initializeWindow: bool = True, destroyOldWindow: bool = True)
crs(self) QgsCoordinateReferenceSystem

Returns the CRS currently selected in the widget.

See also

setCrs()

Return type:

QgsCoordinateReferenceSystem

crsChanged

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.

Parameters:
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type:

PYQT_SIGNAL

crsDoubleClicked

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.

Parameters:
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type:

PYQT_SIGNAL

customEvent(self, QEvent)
destroy(self, destroyWindow: bool = True, destroySubWindows: bool = True)
disconnectNotify(self, QMetaMethod)
dragEnterEvent(self, QDragEnterEvent)
dragLeaveEvent(self, QDragLeaveEvent)
dragMoveEvent(self, QDragMoveEvent)
dropEvent(self, QDropEvent)
enterEvent(self, QEvent)
event(self, QEvent) bool
filters(self) QgsCoordinateReferenceSystemProxyModel.Filters

Returns the filters set on the available CRS.

See also

setFilters()

New in version 3.36.

Return type:

QgsCoordinateReferenceSystemProxyModel.Filters

focusInEvent(self, QFocusEvent)
focusNextChild(self) bool
focusNextPrevChild(self, bool) bool
focusOutEvent(self, QFocusEvent)
focusPreviousChild(self) bool
hasValidSelection(self) bool

Returns True if the widget has a valid CRS defined.

Return type:

bool

hasValidSelectionChanged

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.

Parameters:
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type:

PYQT_SIGNAL

hideEvent(self, QHideEvent)
initPainter(self, QPainter)
inputMethodEvent(self, QInputMethodEvent)
isSignalConnected(self, QMetaMethod) bool
keyPressEvent(self, event: QKeyEvent)

Overridden key press event to handle the esc event on the widget.

Parameters:

event – The key event

keyReleaseEvent(self, QKeyEvent)
leaveEvent(self, QEvent)
metric(self, QPaintDevice.PaintDeviceMetric) int
mouseDoubleClickEvent(self, QMouseEvent)
mouseMoveEvent(self, QMouseEvent)
mousePressEvent(self, QMouseEvent)
mouseReleaseEvent(self, QMouseEvent)
moveEvent(self, QMoveEvent)
nativeEvent(self, Union[QByteArray, bytes, bytearray], PyQt5.sip.voidptr) Tuple[bool, int]
paintEvent(self, QPaintEvent)
receivers(self, PYQT_SIGNAL) int
resizeEvent(self, QResizeEvent)
sender(self) QObject
senderSignalIndex(self) int
setCrs(self, crs: QgsCoordinateReferenceSystem)

Sets the crs to show within the widget.

See also

crs()

Parameters:

crs (QgsCoordinateReferenceSystem) –

setFilters(self, filters: QgsCoordinateReferenceSystemProxyModel.Filters | QgsCoordinateReferenceSystemProxyModel.Filter)

Sets filters for the available CRS.

See also

filters()

New in version 3.36.

Parameters:

filters (Union[QgsCoordinateReferenceSystemProxyModel.Filters) –

setMessage(self, message: str)

Sets a message to show in the dialog.

Parameters:

message (str) –

setNotSetText(self, text: str, description: str = '')

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 (str) –

  • description (str = '') –

setOgcWmsCrsFilter(self, crsFilter: Iterable[str])

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[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)

Sets whether a “no/invalid” CRS option should be shown. If this option is selected, calling crs() will return an invalid QgsCoordinateReferenceSystem.

See also

showNoCrs()

Parameters:

show (bool) –

sharedPainter(self) QPainter
showEvent(self, QShowEvent)
showNoCrs(self) bool

Returns whether the “no/invalid” CRS option is shown. If this option is selected, calling crs() will return an invalid QgsCoordinateReferenceSystem.

See also

setShowNoCrs()

Return type:

bool

tabletEvent(self, QTabletEvent)
timerEvent(self, QTimerEvent)
updateMicroFocus(self)
wheelEvent(self, QWheelEvent)