QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
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 #include <QPointer>
26 
28 #include "qgis_gui.h"
29 
32 class QLabel;
33 
40 class GUI_EXPORT QgsProjectionSelectionWidget : public QWidget
41 {
42  Q_OBJECT
43  public:
44 
48  enum CrsOption
49  {
56  };
57 
59  explicit QgsProjectionSelectionWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr );
60 
66 
73  void setOptionVisible( CrsOption option, bool visible );
74 
80  bool optionVisible( CrsOption option ) const;
81 
87  void setNotSetText( const QString &text );
88 
95  void setMessage( const QString &text );
96 
103  static QString crsOptionText( const QgsCoordinateReferenceSystem &crs ) SIP_SKIP;
104 
112  bool showAccuracyWarnings() const;
113 
121  void setShowAccuracyWarnings( bool show );
122 
132  void setSourceEnsemble( const QString &ensemble );
133 
143  QString sourceEnsemble() const;
144 
150  void setDialogTitle( const QString &title );
151 
157  QString dialogTitle() const;
158 
159  signals:
160 
164  void crsChanged( const QgsCoordinateReferenceSystem & );
165 
170  void cleared();
171 
172  public slots:
173 
178  void setCrs( const QgsCoordinateReferenceSystem &crs );
179 
185  void setLayerCrs( const QgsCoordinateReferenceSystem &crs );
186 
190  void selectCrs();
191 
192  protected:
193 
194  void dragEnterEvent( QDragEnterEvent *event ) override;
195  void dragLeaveEvent( QDragLeaveEvent *event ) override;
196  void dropEvent( QDropEvent *event ) override;
197 
198  private:
199 
202  QgsCoordinateReferenceSystem mProjectCrs;
203  QgsCoordinateReferenceSystem mDefaultCrs;
204  QgsHighlightableComboBox *mCrsComboBox = nullptr;
205  QToolButton *mButton = nullptr;
206  QString mNotSetText;
207  QString mMessage;
208 
209  bool mShowAccuracyWarnings = false;
210  QString mSourceEnsemble;
211 
212  QWidget *mWarningLabelContainer = nullptr;
213  QLabel *mWarningLabel = nullptr;
214 
215  QPointer< QgsCrsSelectionWidget > mActivePanel;
216  int mIgnorePanelSignals = 0;
217 
218  QString mDialogTitle;
219 
220  void addNotSetOption();
221  void addProjectCrsOption();
222  void addDefaultCrsOption();
223  void addCurrentCrsOption();
224 
225  void addRecentCrs();
226  bool crsIsShown( long srsid ) const;
227 
228  int firstRecentCrsIndex() const;
229  void updateTooltip();
230 
231  QgsMapLayer *mapLayerFromMimeData( const QMimeData *data ) const;
232 
233  private slots:
234 
235  void comboIndexChanged( int idx );
236  void updateWarning();
237 
238 };
239 
240 #endif // QGSPROJECTIONSELECTIONWIDGET_H
QgsCrsSelectionWidget
A generic widget allowing users to pick a Coordinate Reference System (or define their own).
Definition: qgsprojectionselectiondialog.h:39
crs
const QgsCoordinateReferenceSystem & crs
Definition: qgswfsgetfeature.cpp:105
QgsProjectionSelectionWidget
A widget for selecting a projection.
Definition: qgsprojectionselectionwidget.h:40
SIP_SKIP
#define SIP_SKIP
Definition: qgis_sip.h:126
QgsProjectionSelectionWidget::ProjectCrs
@ ProjectCrs
Current project CRS (if OTF reprojection enabled)
Definition: qgsprojectionselectionwidget.h:51
QgsHighlightableComboBox
A QComboBox subclass with the ability to "highlight" the edges of the widget.
Definition: qgshighlightablecombobox.h:34
qgis_sip.h
QgsProjectionSelectionWidget::RecentCrs
@ RecentCrs
Recently used CRS.
Definition: qgsprojectionselectionwidget.h:54
QgsProjectionSelectionWidget::CrsNotSet
@ CrsNotSet
Not set (hidden by default)
Definition: qgsprojectionselectionwidget.h:55
QgsCoordinateReferenceSystem
This class represents a coordinate reference system (CRS).
Definition: qgscoordinatereferencesystem.h:211
QgsProjectionSelectionWidget::LayerCrs
@ LayerCrs
Optional layer CRS.
Definition: qgsprojectionselectionwidget.h:50
QgsProjectionSelectionWidget::DefaultCrs
@ DefaultCrs
Global default QGIS CRS.
Definition: qgsprojectionselectionwidget.h:53
QgsMapLayer
Base class for all map layer types. This is the base class for all map layer types (vector,...
Definition: qgsmaplayer.h:72
QgsProjectionSelectionWidget::CrsOption
CrsOption
Predefined CRS options shown in widget.
Definition: qgsprojectionselectionwidget.h:48
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
qgscoordinatereferencesystem.h
QgsProjectionSelectionWidget::CurrentCrs
@ CurrentCrs
Current user selected CRS.
Definition: qgsprojectionselectionwidget.h:52