QGIS API Documentation  3.6.0-Noosa (5873452)
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 
94  signals:
95 
99  void crsChanged( const QgsCoordinateReferenceSystem & );
100 
105  void cleared();
106 
107  public slots:
108 
113  void setCrs( const QgsCoordinateReferenceSystem &crs );
114 
120  void setLayerCrs( const QgsCoordinateReferenceSystem &crs );
121 
125  void selectCrs();
126 
127  private:
128 
131  QgsCoordinateReferenceSystem mProjectCrs;
132  QgsCoordinateReferenceSystem mDefaultCrs;
133  QComboBox *mCrsComboBox = nullptr;
134  QToolButton *mButton = nullptr;
135  QgsProjectionSelectionDialog *mDialog = nullptr;
136  QString mNotSetText;
137  QString mMessage;
138 
139  void addNotSetOption();
140  void addProjectCrsOption();
141  void addDefaultCrsOption();
142  void addCurrentCrsOption();
143  QString currentCrsOptionText( const QgsCoordinateReferenceSystem &crs ) const;
144  void addRecentCrs();
145  bool crsIsShown( long srsid ) const;
146 
147  int firstRecentCrsIndex() const;
148 
149  private slots:
150 
151  void comboIndexChanged( int idx );
152 
153 };
154 
155 #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.
A widget for selecting a projection.
This class represents a coordinate reference system (CRS).