Class: QgsProjectionSelectionDialog

class qgis.gui.QgsProjectionSelectionDialog(parent: QWidget = None, fl: Union[Qt.WindowFlags, Qt.WindowType] = QgsGuiUtils.ModalDialogFlags)

Bases: PyQt5.QtWidgets.QDialog

Constructor for QgsProjectionSelectionDialog.

A generic dialog to prompt the user for a Coordinate Reference System.

Typically you will use this when you want to prompt the user for a coordinate system identifier e.g. from a plugin you might do this to get an epsg code:

crs = QgsCoordinateReferenceSystem()
mySelector = QgsProjectionSelectionDialog( iface.mainWindow() )
mySelector.setCrs( crs )
if mySelector.exec():
  mCrs = mySelector.crs()

If you wish to embed the projection selector into an existing dialog the you probably want to look at QgsProjectionSelectionWidget instead.

New in version 3.0.

Parameters
  • parent (QWidget = None) –

  • fl

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

New in version 3.0.

Return type

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
eventFilter(self, QObject, QEvent) → bool
focusInEvent(self, QFocusEvent)
focusNextChild(self) → bool
focusNextPrevChild(self, bool) → bool
focusOutEvent(self, QFocusEvent)
focusPreviousChild(self) → bool
hideEvent(self, QHideEvent)
initPainter(self, QPainter)
inputMethodEvent(self, QInputMethodEvent)
isSignalConnected(self, QMetaMethod) → bool
keyPressEvent(self, QKeyEvent)
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 initial crs to show within the dialog.

See also

crs()

New in version 3.0.

Parameters

crs (QgsCoordinateReferenceSystem) –

setMessage(self, message: str)

Sets a message to show in the dialog.

Parameters

message (str) –

setNotSetText(self, text: 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 setShowNoProjection().

New in version 3.16.

Parameters

text (str) –

setOgcWmsCrsFilter(self, crsFilter: Iterable[str])

filters this dialog by the given CRSs

Sets this dialog to filter the available projections 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 projections 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.

setShowNoProjection(self, show: bool)

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

New in version 3.0.

Parameters

show (bool) –

sharedPainter(self) → QPainter
showEvent(self, QShowEvent)
showNoCrsForLayerMessage(self)

When called, the dialog will show a default “layer has no CRS set” message above the projection selector.

See also

setMessage()

New in version 3.16.

showNoProjection(self) → bool

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

New in version 3.0.

Return type

bool

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