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 specifiedparent
widget.Methods
Returns the CRS currently selected in the widget.
Returns
True
if the widget has a valid CRS defined.Overridden key press event to handle the esc event on the widget.
Sets the
crs
to show within the widget.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.
- 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
- Return type
- 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
- 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 invalidQgsCoordinateReferenceSystem
.See also
- Parameters
show (bool) –
- 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 invalidQgsCoordinateReferenceSystem
.See also
- Return type
bool
- tabletEvent(self, QTabletEvent)¶
- timerEvent(self, QTimerEvent)¶
- updateMicroFocus(self)¶
- wheelEvent(self, QWheelEvent)¶