QGIS API Documentation  3.4.15-Madeira (e83d02e274)
Public Types | Public Slots | Signals | Public Member Functions | List of all members
QgsProjectionSelectionWidget Class Reference

A widget for selecting a projection. More...

#include <qgsprojectionselectionwidget.h>

Inheritance diagram for QgsProjectionSelectionWidget:
Inheritance graph
[legend]

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...
 
bool optionVisible (CrsOption option) const
 Returns whether the specified CRS option is visible 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...
 

Detailed Description

A widget for selecting a projection.

Since
QGIS 2.7

Definition at line 37 of file qgsprojectionselectionwidget.h.

Member Enumeration Documentation

Predefined CRS options shown in widget.

Enumerator
LayerCrs 

Optional layer CRS.

ProjectCrs 

Current project CRS (if OTF reprojection enabled)

CurrentCrs 

Current user selected CRS.

DefaultCrs 

Global default QGIS CRS.

RecentCrs 

Recently used CRS.

CrsNotSet 

Not set (hidden by default)

Definition at line 45 of file qgsprojectionselectionwidget.h.

Constructor & Destructor Documentation

QgsProjectionSelectionWidget::QgsProjectionSelectionWidget ( QWidget *  parent = nullptr)
explicit

Constructor for QgsProjectionSelectionWidget.

Definition at line 24 of file qgsprojectionselectionwidget.cpp.

Member Function Documentation

void QgsProjectionSelectionWidget::cleared ( )
signal

Emitted when the not set option is selected.

Since
QGIS 3.0
QgsCoordinateReferenceSystem QgsProjectionSelectionWidget::crs ( ) const

Returns the currently selected CRS for the widget.

Returns
current CRS

Definition at line 66 of file qgsprojectionselectionwidget.cpp.

void QgsProjectionSelectionWidget::crsChanged ( const QgsCoordinateReferenceSystem )
signal

Emitted when the selected CRS is changed.

bool QgsProjectionSelectionWidget::optionVisible ( QgsProjectionSelectionWidget::CrsOption  option) const

Returns whether the specified CRS option is visible in the widget.

See also
setOptionVisible()
Since
QGIS 3.0

Definition at line 163 of file qgsprojectionselectionwidget.cpp.

void QgsProjectionSelectionWidget::selectCrs ( )
slot

Opens the dialog for selecting a new CRS.

Definition at line 169 of file qgsprojectionselectionwidget.cpp.

void QgsProjectionSelectionWidget::setCrs ( const QgsCoordinateReferenceSystem crs)
slot

Sets the current CRS for the widget.

Parameters
crsnew CRS

Definition at line 234 of file qgsprojectionselectionwidget.cpp.

void QgsProjectionSelectionWidget::setLayerCrs ( const QgsCoordinateReferenceSystem crs)
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.

Parameters
crslayer CRS

Definition at line 268 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'.

Since
QGIS 3.0

Definition at line 158 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().

Since
QGIS 3.0

Definition at line 148 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.

Parameters
optionCRS option to show/hide
visiblewhether the option should be shown
See also
optionVisible()

Definition at line 90 of file qgsprojectionselectionwidget.cpp.


The documentation for this class was generated from the following files: