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) Constructor for QgsCrsSelectionWidget, with the specified parent widget.

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

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.

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

Emitted when the CRS defined in the widget is changed.

crsDoubleClicked

Emitted when a CRS entry in the widget is double-clicked.

hasValidSelectionChanged

Emitted when the widget has a valid selection or not.

actionEvent(self, QActionEvent)
changeEvent(self, QEvent)
childEvent(self, QChildEvent)
closeEvent(self, QCloseEvent)
connectNotify(self, QMetaMethod)
contextMenuEvent(self, QContextMenuEvent)
create(self, window: 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

Emitted when the CRS defined in the widget is changed. [signal]

crsDoubleClicked

Emitted when a CRS entry in the widget is double-clicked. [signal]

Parameters

crs (QgsCoordinateReferenceSystem) –

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

Emitted when the widget has a valid selection or not. [signal]

Parameters

isValid (bool) –

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], 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) –

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)