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 =

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.

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

Returns the CRS currently selected in the widget.

See also


New in version 3.0.

Return type


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


New in version 3.0.


crs (QgsCoordinateReferenceSystem) –

setMessage(self, message: str)

Sets a message to show in the dialog.


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.


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.


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.


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.


show (bool) –

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

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

See also


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


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