QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
Public Slots | Signals | Public Member Functions | List of all members
QgsCrsSelectionWidget Class Reference

A generic widget allowing users to pick a Coordinate Reference System (or define their own). More...

#include <qgsprojectionselectiondialog.h>

Inheritance diagram for QgsCrsSelectionWidget:
Inheritance graph
[legend]

Public Slots

void setCrs (const QgsCoordinateReferenceSystem &crs)
 Sets the crs to show within the widget. More...
 
void setOgcWmsCrsFilter (const QSet< QString > &crsFilter)
 filters this dialog by the given CRSs More...
 
- Public Slots inherited from QgsPanelWidget
void acceptPanel ()
 Accept the panel. More...
 
void openPanel (QgsPanelWidget *panel)
 Open a panel or dialog depending on dock mode setting If dock mode is true this method will emit the showPanel signal for connected slots to handle the open event. More...
 

Signals

void crsChanged ()
 Emitted when the CRS defined in the widget is changed. More...
 
void crsDoubleClicked (const QgsCoordinateReferenceSystem &crs)
 Emitted when a CRS entry in the widget is double-clicked. More...
 
void hasValidSelectionChanged (bool isValid)
 Emitted when the widget has a valid selection or not. More...
 
- Signals inherited from QgsPanelWidget
void panelAccepted (QgsPanelWidget *panel)
 Emitted when the panel is accepted by the user. More...
 
void showPanel (QgsPanelWidget *panel)
 Emit when you require a panel to be show in the interface. More...
 
void widgetChanged ()
 Emitted when the widget state changes. More...
 

Public Member Functions

 QgsCrsSelectionWidget (QWidget *parent=nullptr, QgsCoordinateReferenceSystemProxyModel::Filters filters=QgsCoordinateReferenceSystemProxyModel::FilterHorizontal|QgsCoordinateReferenceSystemProxyModel::FilterCompound)
 Constructor for QgsCrsSelectionWidget, with the specified parent widget. More...
 
 ~QgsCrsSelectionWidget () override
 
QgsCoordinateReferenceSystem crs () const
 Returns the CRS currently selected in the widget. More...
 
QgsCoordinateReferenceSystemProxyModel::Filters filters () const
 Returns the filters set on the available CRS. More...
 
bool hasValidSelection () const
 Returns true if the widget has a valid CRS defined. More...
 
void setFilters (QgsCoordinateReferenceSystemProxyModel::Filters filters)
 Sets filters for the available CRS. More...
 
void setMessage (const QString &message)
 Sets a message to show in the dialog. More...
 
void setNotSetText (const QString &text, const QString &description=QString())
 Sets the text to show for the not set option. More...
 
void setShowNoCrs (bool show)
 Sets whether a "no/invalid" CRS option should be shown. More...
 
bool showNoCrs () const
 Returns whether the "no/invalid" CRS option is shown. More...
 
- Public Member Functions inherited from QgsPanelWidget
 QgsPanelWidget (QWidget *parent=nullptr)
 Base class for any widget that can be shown as a inline panel. More...
 
virtual bool applySizeConstraintsToStack () const
 Returns true if the size constraints and hints for the panel widget should be applied to the parent QgsPanelWidgetStack which this panel is shown in. More...
 
bool autoDelete ()
 The the auto delete property on the widget. More...
 
void connectChildPanel (QgsPanelWidget *panel)
 Connect the given sub panel widgets showPanel signals to this current panels main showPanel event to bubble up to the user. More...
 
void connectChildPanels (const QList< QgsPanelWidget * > &panels)
 Connect the given sub panel widgets showPanel signals to this current panels main showPanel event to bubble up to the user. More...
 
bool dockMode ()
 Returns the dock mode state. More...
 
virtual QMenu * menuButtonMenu ()
 Returns the menu to use for the menu button for this panel, or nullptr if no menu button is required. More...
 
virtual QString menuButtonTooltip () const
 Returns the (translated) tooltip text to use for the menu button for this panel. More...
 
QString panelTitle ()
 The title of the panel. More...
 
void setAutoDelete (bool autoDelete)
 The the auto delete property on the widget. More...
 
virtual void setDockMode (bool dockMode)
 Set the widget in dock mode which tells the widget to emit panel widgets and not open dialogs. More...
 
void setPanelTitle (const QString &panelTitle)
 Set the title of the panel when shown in the interface. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from QgsPanelWidget
static QgsPanelWidgetfindParentPanel (QWidget *widget)
 Traces through the parents of a widget to find if it is contained within a QgsPanelWidget widget. More...
 
- Protected Member Functions inherited from QgsPanelWidget
void keyPressEvent (QKeyEvent *event) override
 Overridden key press event to handle the esc event on the widget. More...
 

Detailed Description

A generic widget allowing users to pick a Coordinate Reference System (or define their own).

Since
QGIS 3.24

Definition at line 39 of file qgsprojectionselectiondialog.h.

Constructor & Destructor Documentation

◆ QgsCrsSelectionWidget()

Constructor for QgsCrsSelectionWidget, 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 32 of file qgsprojectionselectiondialog.cpp.

◆ ~QgsCrsSelectionWidget()

QgsCrsSelectionWidget::~QgsCrsSelectionWidget ( )
override

Definition at line 113 of file qgsprojectionselectiondialog.cpp.

Member Function Documentation

◆ crs()

QgsCoordinateReferenceSystem QgsCrsSelectionWidget::crs ( ) const

Returns the CRS currently selected in the widget.

See also
setCrs()

Definition at line 203 of file qgsprojectionselectiondialog.cpp.

◆ crsChanged

void QgsCrsSelectionWidget::crsChanged ( )
signal

Emitted when the CRS defined in the widget is changed.

◆ crsDoubleClicked

void QgsCrsSelectionWidget::crsDoubleClicked ( const QgsCoordinateReferenceSystem crs)
signal

Emitted when a CRS entry in the widget is double-clicked.

◆ filters()

QgsCoordinateReferenceSystemProxyModel::Filters QgsCrsSelectionWidget::filters ( ) const

Returns the filters set on the available CRS.

See also
setFilters()
Since
QGIS 3.36

Definition at line 193 of file qgsprojectionselectiondialog.cpp.

◆ hasValidSelection()

bool QgsCrsSelectionWidget::hasValidSelection ( ) const

Returns true if the widget has a valid CRS defined.

Definition at line 174 of file qgsprojectionselectiondialog.cpp.

◆ hasValidSelectionChanged

void QgsCrsSelectionWidget::hasValidSelectionChanged ( bool  isValid)
signal

Emitted when the widget has a valid selection or not.

◆ setCrs

void QgsCrsSelectionWidget::setCrs ( const QgsCoordinateReferenceSystem crs)
slot

Sets the crs to show within the widget.

See also
crs()

Definition at line 220 of file qgsprojectionselectiondialog.cpp.

◆ setFilters()

void QgsCrsSelectionWidget::setFilters ( QgsCoordinateReferenceSystemProxyModel::Filters  filters)

Sets filters for the available CRS.

See also
filters()
Since
QGIS 3.36

Definition at line 198 of file qgsprojectionselectiondialog.cpp.

◆ setMessage()

void QgsCrsSelectionWidget::setMessage ( const QString &  message)

Sets a message to show in the dialog.

Definition at line 119 of file qgsprojectionselectiondialog.cpp.

◆ setNotSetText()

void QgsCrsSelectionWidget::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 setShowNoCrs().

The description argument can be used to specify a detailed description which is shown when the option is selected.

Definition at line 162 of file qgsprojectionselectiondialog.cpp.

◆ setOgcWmsCrsFilter

void QgsCrsSelectionWidget::setOgcWmsCrsFilter ( const QSet< QString > &  crsFilter)
slot

filters this dialog by the given CRSs

Sets this dialog to filter the available CRSs to those listed by the given Coordinate Reference Systems.

Parameters
crsFiltera list of OGC Coordinate Reference Systems to filter the list of CRS by. This is useful in (e.g.) WMS situations where you just want to offer what the WMS server can support.
Warning
This function's behavior is undefined if it is called after the dialog is shown.

Definition at line 251 of file qgsprojectionselectiondialog.cpp.

◆ setShowNoCrs()

void QgsCrsSelectionWidget::setShowNoCrs ( bool  show)

Sets whether a "no/invalid" CRS option should be shown.

If this option is selected, calling crs() will return an invalid QgsCoordinateReferenceSystem.

See also
showNoCrs()

Definition at line 126 of file qgsprojectionselectiondialog.cpp.

◆ showNoCrs()

bool QgsCrsSelectionWidget::showNoCrs ( ) const

Returns whether the "no/invalid" CRS option is shown.

If this option is selected, calling crs() will return an invalid QgsCoordinateReferenceSystem.

See also
setShowNoCrs()

Definition at line 157 of file qgsprojectionselectiondialog.cpp.


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