QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
|
A generic dialog to prompt the user for a Coordinate Reference System. More...
#include <qgsprojectionselectiondialog.h>
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 | |
Public Member Functions | |
QgsProjectionSelectionDialog (QWidget *parent=nullptr, Qt::WindowFlags fl=QgsGuiUtils::ModalDialogFlags) | |
Constructor for QgsProjectionSelectionDialog. | |
QgsCoordinateReferenceSystem | crs () const |
Returns the CRS currently selected in the widget. | |
bool | hasValidSelection () const |
Returns true if the dialog has a valid CRS defined. | |
void | setMessage (const QString &message) |
Sets a message to show in the dialog. | |
void | setNotSetText (const QString &text, const QString &description=QString()) |
Sets the text to show for the not set option. | |
void | setRequireValidSelection () |
Sets the dialog to require a valid selection only, preventing users from accepting the dialog if no selection is present. | |
void | setShowNoProjection (bool show) |
Sets whether a "no/invalid" projection option should be shown. | |
void | showNoCrsForLayerMessage () |
When called, the dialog will show a default "layer has no CRS set" message above the projection selector. | |
bool | showNoProjection () const |
Returns whether the "no/invalid" projection option is shown. | |
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:
If you wish to embed the projection selector into an existing dialog the you probably want to look at QgsProjectionSelectionWidget instead.
Definition at line 170 of file qgsprojectionselectiondialog.h.
QgsProjectionSelectionDialog::QgsProjectionSelectionDialog | ( | QWidget * | parent = nullptr , |
Qt::WindowFlags | fl = QgsGuiUtils::ModalDialogFlags |
||
) |
Constructor for QgsProjectionSelectionDialog.
Definition at line 249 of file qgsprojectionselectiondialog.cpp.
QgsCoordinateReferenceSystem QgsProjectionSelectionDialog::crs | ( | ) | const |
Returns the CRS currently selected in the widget.
Definition at line 317 of file qgsprojectionselectiondialog.cpp.
bool QgsProjectionSelectionDialog::hasValidSelection | ( | ) | const |
Returns true
if the dialog has a valid CRS defined.
Definition at line 312 of file qgsprojectionselectiondialog.cpp.
|
slot |
Sets the initial crs to show within the dialog.
Definition at line 322 of file qgsprojectionselectiondialog.cpp.
void QgsProjectionSelectionDialog::setMessage | ( | const QString & | message | ) |
Sets a message to show in the dialog.
Definition at line 273 of file qgsprojectionselectiondialog.cpp.
void QgsProjectionSelectionDialog::setNotSetText | ( | const QString & | text, |
const QString & | description = QString() |
||
) |
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().
Since QGIS 3.24, the description argument can be used to specify a detailed description which is shown when the option is selected.
Definition at line 296 of file qgsprojectionselectiondialog.cpp.
|
slot |
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 | 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. |
Definition at line 330 of file qgsprojectionselectiondialog.cpp.
void QgsProjectionSelectionDialog::setRequireValidSelection | ( | ) |
Sets the dialog to require a valid selection only, preventing users from accepting the dialog if no selection is present.
Definition at line 301 of file qgsprojectionselectiondialog.cpp.
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.
Definition at line 286 of file qgsprojectionselectiondialog.cpp.
void QgsProjectionSelectionDialog::showNoCrsForLayerMessage | ( | ) |
When called, the dialog will show a default "layer has no CRS set" message above the projection selector.
Definition at line 278 of file qgsprojectionselectiondialog.cpp.
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.
Definition at line 291 of file qgsprojectionselectiondialog.cpp.