QGIS API Documentation  3.8.0-Zanzibar (11aff65)
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 "qgis_sip.h"
22 #include <QLineEdit>
23 #include <QToolButton>
24 #include <QComboBox>
25 
27 #include "qgis_gui.h"
28 
30 
37 class GUI_EXPORT QgsProjectionSelectionWidget : public QWidget
38 {
39  Q_OBJECT
40  public:
41 
45  enum CrsOption
46  {
53  };
54 
56  explicit QgsProjectionSelectionWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr );
57 
63 
70  void setOptionVisible( CrsOption option, bool visible );
71 
77  bool optionVisible( CrsOption option ) const;
78 
84  void setNotSetText( const QString &text );
85 
92  void setMessage( const QString &text );
93 
100  static QString crsOptionText( const QgsCoordinateReferenceSystem &crs ) SIP_SKIP;
101 
102  signals:
103 
107  void crsChanged( const QgsCoordinateReferenceSystem & );
108 
113  void cleared();
114 
115  public slots:
116 
121  void setCrs( const QgsCoordinateReferenceSystem &crs );
122 
128  void setLayerCrs( const QgsCoordinateReferenceSystem &crs );
129 
133  void selectCrs();
134 
135  private:
136 
139  QgsCoordinateReferenceSystem mProjectCrs;
140  QgsCoordinateReferenceSystem mDefaultCrs;
141  QComboBox *mCrsComboBox = nullptr;
142  QToolButton *mButton = nullptr;
143  QgsProjectionSelectionDialog *mDialog = nullptr;
144  QString mNotSetText;
145  QString mMessage;
146 
147  void addNotSetOption();
148  void addProjectCrsOption();
149  void addDefaultCrsOption();
150  void addCurrentCrsOption();
151 
152  void addRecentCrs();
153  bool crsIsShown( long srsid ) const;
154 
155  int firstRecentCrsIndex() const;
156 
157  private slots:
158 
159  void comboIndexChanged( int idx );
160 
161 };
162 
163 #endif // QGSPROJECTIONSELECTIONWIDGET_H
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:46
Current project CRS (if OTF reprojection enabled)
const QgsCoordinateReferenceSystem & crs
A generic dialog to prompt the user for a Coordinate Reference System.
CrsOption
Predefined CRS options shown in widget.
#define SIP_SKIP
Definition: qgis_sip.h:119
A widget for selecting a projection.
This class represents a coordinate reference system (CRS).