QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
|
A widget for selecting a projection. More...
#include <qgsprojectionselectionwidget.h>
Public Types | |
enum | CrsOption { LayerCrs , ProjectCrs , CurrentCrs , DefaultCrs , RecentCrs , CrsNotSet } |
Predefined CRS options shown in widget. More... | |
Public Slots | |
void | selectCrs () |
Opens the dialog for selecting a new CRS. More... | |
void | setCrs (const QgsCoordinateReferenceSystem &crs) |
Sets the current CRS for the widget. More... | |
void | setLayerCrs (const QgsCoordinateReferenceSystem &crs) |
Sets the layer CRS for the widget. More... | |
Signals | |
void | cleared () |
Emitted when the not set option is selected. More... | |
void | crsChanged (const QgsCoordinateReferenceSystem &) |
Emitted when the selected CRS is changed. More... | |
Public Member Functions | |
QgsProjectionSelectionWidget (QWidget *parent=nullptr) | |
Constructor for QgsProjectionSelectionWidget. More... | |
QgsCoordinateReferenceSystem | crs () const |
Returns the currently selected CRS for the widget. More... | |
QString | dialogTitle () const |
Returns the title for the CRS selector dialog window. More... | |
bool | optionVisible (CrsOption option) const |
Returns whether the specified CRS option is visible in the widget. More... | |
void | setDialogTitle (const QString &title) |
Sets the title for the CRS selector dialog window. More... | |
void | setFilter (const QList< QgsCoordinateReferenceSystem > &crses) |
Sets a filtered list of CRSes to show in the widget. More... | |
void | setMessage (const QString &text) |
Sets a message to show in the dialog. More... | |
void | setNotSetText (const QString &text) |
Sets the text to show for the not set option. More... | |
void | setOptionVisible (CrsOption option, bool visible) |
Sets whether a predefined CRS option should be shown in the widget. More... | |
void | setShowAccuracyWarnings (bool show) |
Sets whether the widget will show warnings to users when they select a CRS which has low accuracy. More... | |
void | setSourceEnsemble (const QString &ensemble) |
Sets the original source ensemble datum name. More... | |
bool | showAccuracyWarnings () const |
Returns true if the widget will show a warning to users when they select a CRS which has low accuracy. More... | |
QString | sourceEnsemble () const |
Returns the original source ensemble datum name. More... | |
Static Public Member Functions | |
static QString | crsOptionText (const QgsCoordinateReferenceSystem &crs) |
Returns display text for the specified crs. More... | |
Protected Member Functions | |
void | dragEnterEvent (QDragEnterEvent *event) override |
void | dragLeaveEvent (QDragLeaveEvent *event) override |
void | dropEvent (QDropEvent *event) override |
A widget for selecting a projection.
Definition at line 40 of file qgsprojectionselectionwidget.h.
Predefined CRS options shown in widget.
Definition at line 48 of file qgsprojectionselectionwidget.h.
|
explicit |
Constructor for QgsProjectionSelectionWidget.
Definition at line 27 of file qgsprojectionselectionwidget.cpp.
|
signal |
Emitted when the not set option is selected.
QgsCoordinateReferenceSystem QgsProjectionSelectionWidget::crs | ( | ) | const |
Returns the currently selected CRS for the widget.
Definition at line 121 of file qgsprojectionselectionwidget.cpp.
|
signal |
Emitted when the selected CRS is changed.
|
static |
Returns display text for the specified crs.
Definition at line 592 of file qgsprojectionselectionwidget.cpp.
QString QgsProjectionSelectionWidget::dialogTitle | ( | ) | const |
Returns the title for the CRS selector dialog window.
Definition at line 363 of file qgsprojectionselectionwidget.cpp.
|
overrideprotected |
Definition at line 291 of file qgsprojectionselectionwidget.cpp.
|
overrideprotected |
Definition at line 313 of file qgsprojectionselectionwidget.cpp.
|
overrideprotected |
Definition at line 327 of file qgsprojectionselectionwidget.cpp.
bool QgsProjectionSelectionWidget::optionVisible | ( | QgsProjectionSelectionWidget::CrsOption | option | ) | const |
Returns whether the specified CRS option is visible in the widget.
Definition at line 199 of file qgsprojectionselectionwidget.cpp.
|
slot |
Opens the dialog for selecting a new CRS.
Definition at line 205 of file qgsprojectionselectionwidget.cpp.
|
slot |
Sets the current CRS for the widget.
crs | new CRS |
Definition at line 507 of file qgsprojectionselectionwidget.cpp.
void QgsProjectionSelectionWidget::setDialogTitle | ( | const QString & | title | ) |
Sets the title for the CRS selector dialog window.
Definition at line 358 of file qgsprojectionselectionwidget.cpp.
void QgsProjectionSelectionWidget::setFilter | ( | const QList< QgsCoordinateReferenceSystem > & | crses | ) |
Sets a filtered list of CRSes to show in the widget.
Definition at line 368 of file qgsprojectionselectionwidget.cpp.
|
slot |
Sets the layer CRS for the widget.
If set, this will be added as an option to the preset CRSes shown in the widget.
crs | layer CRS |
Definition at line 548 of file qgsprojectionselectionwidget.cpp.
void QgsProjectionSelectionWidget::setMessage | ( | const QString & | text | ) |
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'.
Definition at line 194 of file qgsprojectionselectionwidget.cpp.
void QgsProjectionSelectionWidget::setNotSetText | ( | const QString & | text | ) |
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 setOptionVisible().
Definition at line 184 of file qgsprojectionselectionwidget.cpp.
void QgsProjectionSelectionWidget::setOptionVisible | ( | const QgsProjectionSelectionWidget::CrsOption | option, |
bool | visible | ||
) |
Sets whether a predefined CRS option should be shown in the widget.
option | CRS option to show/hide |
visible | whether the option should be shown |
Definition at line 126 of file qgsprojectionselectionwidget.cpp.
void QgsProjectionSelectionWidget::setShowAccuracyWarnings | ( | bool | show | ) |
Sets whether the widget will show warnings to users when they select a CRS which has low accuracy.
Definition at line 394 of file qgsprojectionselectionwidget.cpp.
void QgsProjectionSelectionWidget::setSourceEnsemble | ( | const QString & | ensemble | ) |
Sets the original source ensemble datum name.
If set, CRS accuracy warnings will not be shown when the selected CRS in the widget has a matching ensemble datum, regardless of the ensemble's accuracy.
Definition at line 380 of file qgsprojectionselectionwidget.cpp.
bool QgsProjectionSelectionWidget::showAccuracyWarnings | ( | ) | const |
Returns true
if the widget will show a warning to users when they select a CRS which has low accuracy.
Definition at line 389 of file qgsprojectionselectionwidget.cpp.
QString QgsProjectionSelectionWidget::sourceEnsemble | ( | ) | const |
Returns the original source ensemble datum name.
If set, CRS accuracy warnings will not be shown when the selected CRS in the widget has a matching ensemble datum, regardless of the ensemble's accuracy.
Definition at line 353 of file qgsprojectionselectionwidget.cpp.