QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
qgsprojectionselectionwidget.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsprojectionselectionwidget.h
3  --------------------------------------
4  Date : 05.01.2015
5  Copyright : (C) 2015 Denis Rouzaud
6  Email : [email protected]
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 
17 #ifndef QGSPROJECTIONSELECTIONWIDGET_H
18 #define QGSPROJECTIONSELECTIONWIDGET_H
19 
20 #include <QWidget>
21 #include <QLineEdit>
22 #include <QToolButton>
23 #include <QComboBox>
24 
26 
28 
35 class GUI_EXPORT QgsProjectionSelectionWidget : public QWidget
36 {
37  Q_OBJECT
38  public:
39 
42  enum CrsOption
43  {
48  RecentCrs
49  };
50 
51  explicit QgsProjectionSelectionWidget( QWidget *parent = nullptr );
52 
57  QgsGenericProjectionSelector* dialog() { return mDialog; }
58 
62  QgsCoordinateReferenceSystem crs() const;
63 
68  void setOptionVisible( const CrsOption option, const bool visible );
69 
70  signals:
71 
74  void crsChanged( const QgsCoordinateReferenceSystem& );
75 
76  public slots:
77 
81  void setCrs( const QgsCoordinateReferenceSystem& crs );
82 
87  void setLayerCrs( const QgsCoordinateReferenceSystem& crs );
88 
91  void selectCrs();
92 
93  private:
94 
97  QgsCoordinateReferenceSystem mProjectCrs;
98  QgsCoordinateReferenceSystem mDefaultCrs;
99  QComboBox* mCrsComboBox;
100  QToolButton* mButton;
102 
103  void addProjectCrsOption();
104  void addDefaultCrsOption();
105  void addRecentCrs();
106  bool crsIsShown( const long srsid ) const;
107 
108  int firstRecentCrsIndex() const;
109 
110  private slots:
111 
112  void comboIndexChanged( int idx );
113 
114 };
115 
116 #endif // QGSPROJECTIONSELECTIONWIDGET_H
QgsGenericProjectionSelector * dialog()
Returns a pointer to the projection selector dialog used by the widget.
A generic dialog to prompt the user for a Coordinate Reference System.
CrsOption
Predefined CRS options shown in widget.
A widget for selecting a projection.
Class for storing a coordinate reference system (CRS)