QGIS API Documentation 3.41.0-Master (3440c17df1d)
|
A widget for selecting a projection. More...
#include <qgsprojectionselectionwidget.h>
Public Types | |
enum | CrsOption { Invalid = 1 << 0 , LayerCrs = 1 << 1 , ProjectCrs = 1 << 2 , CurrentCrs = 1 << 3 , DefaultCrs = 1 << 4 , RecentCrs = 1 << 5 , CrsNotSet = 1 << 6 } |
Predefined CRS options shown in widget. More... | |
typedef QFlags< CrsOption > | CrsOptions |
Flags for predefined CRS options shown in widget. | |
Public Slots | |
void | selectCrs () |
Opens the dialog for selecting a new CRS. | |
void | setCrs (const QgsCoordinateReferenceSystem &crs) |
Sets the current CRS for the widget. | |
void | setLayerCrs (const QgsCoordinateReferenceSystem &crs) |
Sets the layer CRS for the widget. | |
Signals | |
void | cleared () |
Emitted when the not set option is selected. | |
void | crsChanged (const QgsCoordinateReferenceSystem &crs) |
Emitted when the selected CRS is changed. | |
Public Member Functions | |
QgsProjectionSelectionWidget (QWidget *parent=nullptr, QgsCoordinateReferenceSystemProxyModel::Filters filters=QgsCoordinateReferenceSystemProxyModel::FilterHorizontal|QgsCoordinateReferenceSystemProxyModel::FilterCompound) | |
Constructor for QgsProjectionSelectionWidget, with the specified parent widget. | |
QgsCoordinateReferenceSystem | crs () const |
Returns the currently selected CRS for the widget. | |
QString | dialogTitle () const |
Returns the title for the CRS selector dialog window. | |
QgsCoordinateReferenceSystemProxyModel::Filters | filters () const |
Returns the filters set on the available CRS. | |
bool | optionVisible (CrsOption option) const |
Returns whether the specified CRS option is visible in the widget. | |
void | setDialogTitle (const QString &title) |
Sets the title for the CRS selector dialog window. | |
void | setFilter (const QList< QgsCoordinateReferenceSystem > &crses) |
Sets a filtered list of CRSes to show in the widget. | |
void | setFilters (QgsCoordinateReferenceSystemProxyModel::Filters filters) |
Sets filters for the available CRS. | |
void | setMessage (const QString &text) |
Sets a message to show in the dialog. | |
void | setNotSetText (const QString &text) |
Sets the text to show for the not set option. | |
void | setOptionVisible (CrsOption option, bool visible) |
Sets whether a predefined CRS option should be shown in the widget. | |
void | setShowAccuracyWarnings (bool show) |
Sets whether the widget will show warnings to users when they select a CRS which has low accuracy. | |
void | setSourceEnsemble (const QString &ensemble) |
Sets the original source ensemble datum name. | |
bool | showAccuracyWarnings () const |
Returns true if the widget will show a warning to users when they select a CRS which has low accuracy. | |
QString | sourceEnsemble () const |
Returns the original source ensemble datum name. | |
Static Public Member Functions | |
static QString | crsOptionText (const QgsCoordinateReferenceSystem &crs) |
Returns display text for the specified crs. | |
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 45 of file qgsprojectionselectionwidget.h.
typedef QFlags< CrsOption > QgsProjectionSelectionWidget::CrsOptions |
Flags for predefined CRS options shown in widget.
Definition at line 68 of file qgsprojectionselectionwidget.h.
Predefined CRS options shown in widget.
Definition at line 53 of file qgsprojectionselectionwidget.h.
|
explicit |
Constructor for QgsProjectionSelectionWidget, with the specified parent widget.
Since QGIS 3.36, the optional filter argument can be used to specify filters on the systems shown in the widget. The default is to show all horizontal and compound CRS in order to match the behavior of older QGIS releases. The filter can be altered to also include vertical CRS if desired.
Definition at line 408 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 459 of file qgsprojectionselectionwidget.cpp.
|
signal |
Emitted when the selected CRS is changed.
|
static |
Returns display text for the specified crs.
Definition at line 854 of file qgsprojectionselectionwidget.cpp.
QString QgsProjectionSelectionWidget::dialogTitle | ( | ) | const |
Returns the title for the CRS selector dialog window.
Definition at line 681 of file qgsprojectionselectionwidget.cpp.
|
overrideprotected |
Definition at line 609 of file qgsprojectionselectionwidget.cpp.
|
overrideprotected |
Definition at line 631 of file qgsprojectionselectionwidget.cpp.
|
overrideprotected |
Definition at line 645 of file qgsprojectionselectionwidget.cpp.
QgsCoordinateReferenceSystemProxyModel::Filters QgsProjectionSelectionWidget::filters | ( | ) | const |
Returns the filters set on the available CRS.
Definition at line 691 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 516 of file qgsprojectionselectionwidget.cpp.
|
slot |
Opens the dialog for selecting a new CRS.
Definition at line 522 of file qgsprojectionselectionwidget.cpp.
|
slot |
Sets the current CRS for the widget.
crs | new CRS |
Definition at line 814 of file qgsprojectionselectionwidget.cpp.
void QgsProjectionSelectionWidget::setDialogTitle | ( | const QString & | title | ) |
Sets the title for the CRS selector dialog window.
Definition at line 676 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 686 of file qgsprojectionselectionwidget.cpp.
void QgsProjectionSelectionWidget::setFilters | ( | QgsCoordinateReferenceSystemProxyModel::Filters | filters | ) |
Sets filters for the available CRS.
Definition at line 696 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 849 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 511 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 506 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 468 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 717 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 703 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 712 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 671 of file qgsprojectionselectionwidget.cpp.