QgsProjectionSelectionDialog class
A generic dialog to prompt the user for a Coordinate Reference System.
Contents
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:
QgsProjectionSelectionDialog mySelector( mQGisIface->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.
Constructors, destructors, conversion operators
- QgsProjectionSelectionDialog(QWidget* parent = nullptr, Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags)
- Constructor for QgsProjectionSelectionDialog.
Public functions
- auto crs() const -> QgsCoordinateReferenceSystem
- Returns the CRS currently selected in the widget.
- void setMessage(const QString& message)
- Sets a message to show in the dialog.
- void setShowNoProjection(bool show)
- Sets whether a "no/invalid" projection option should be shown.
- auto showNoProjection() const -> bool
- Returns whether the "no/invalid" projection option is shown.
Public slots
- void setCrs(const QgsCoordinateReferenceSystem& crs)
- Sets the initial crs to show within the dialog.
- void setOgcWmsCrsFilter(const QSet<QString>& crsFilter)
- filters this dialog by the given CRSs
Function documentation
QgsCoordinateReferenceSystem QgsProjectionSelectionDialog:: crs() const
Returns the CRS currently selected in the widget.
void QgsProjectionSelectionDialog:: setMessage(const QString& message)
Sets a message to show in the dialog.
If an empty string is passed, the message will be a generic 'define the CRS for this layer'.
void QgsProjectionSelectionDialog:: setShowNoProjection(bool show)
Sets whether a "no/invalid" projection option should be shown.
If this option is selected, calling crs() will return an invalid QgsCoordinateReferenceSystem.
bool QgsProjectionSelectionDialog:: showNoProjection() const
Returns whether the "no/invalid" projection option is shown.
If this option is selected, calling crs() will return an invalid QgsCoordinateReferenceSystem.
void QgsProjectionSelectionDialog:: setCrs(const QgsCoordinateReferenceSystem& crs) public slot
Sets the initial crs to show within the dialog.
void QgsProjectionSelectionDialog:: setOgcWmsCrsFilter(const QSet<QString>& crsFilter) public slot
filters this dialog by the given CRSs
| Parameters | |
|---|---|
| crsFilter | 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. |
Sets this dialog to filter the available projections to those listed by the given Coordinate Reference Systems.