QGIS API Documentation 3.29.0-Master (d0a9f12494)
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
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
32class QLabel;
33
40class GUI_EXPORT QgsProjectionSelectionWidget : public QWidget
41{
42 Q_OBJECT
43 public:
44
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
164 void setFilter( const QList< QgsCoordinateReferenceSystem > &crses );
165
166 signals:
167
172
177 void cleared();
178
179 public slots:
180
185 void setCrs( const QgsCoordinateReferenceSystem &crs );
186
192 void setLayerCrs( const QgsCoordinateReferenceSystem &crs );
193
197 void selectCrs();
198
199 protected:
200
201 void dragEnterEvent( QDragEnterEvent *event ) override;
202 void dragLeaveEvent( QDragLeaveEvent *event ) override;
203 void dropEvent( QDropEvent *event ) override;
204
205 private:
206
211 QgsHighlightableComboBox *mCrsComboBox = nullptr;
212 QToolButton *mButton = nullptr;
213 QString mNotSetText;
214 QString mMessage;
215
216 bool mShowAccuracyWarnings = false;
217 QString mSourceEnsemble;
218
219 QWidget *mWarningLabelContainer = nullptr;
220 QLabel *mWarningLabel = nullptr;
221
222 QPointer< QgsCrsSelectionWidget > mActivePanel;
223 int mIgnorePanelSignals = 0;
224
225 QString mDialogTitle;
226
227 QList<QgsCoordinateReferenceSystem> mFilter;
228
229 void addNotSetOption();
230 void addProjectCrsOption();
231 void addDefaultCrsOption();
232 void addCurrentCrsOption();
233
234 void addRecentCrs();
235 bool crsIsShown( long srsid ) const;
236
237 int firstRecentCrsIndex() const;
238 void updateTooltip();
239
240 QgsMapLayer *mapLayerFromMimeData( const QMimeData *data ) const;
241 QgsCoordinateReferenceSystem crsAtIndex( int index ) const;
242
243 private slots:
244
245 void comboIndexChanged( int idx );
246 void updateWarning();
247
248};
249
250#endif // QGSPROJECTIONSELECTIONWIDGET_H
This class represents a coordinate reference system (CRS).
A generic widget allowing users to pick a Coordinate Reference System (or define their own).
A QComboBox subclass with the ability to "highlight" the edges of the widget.
Base class for all map layer types.
Definition: qgsmaplayer.h:73
A widget for selecting a projection.
void cleared()
Emitted when the not set option is selected.
void crsChanged(const QgsCoordinateReferenceSystem &)
Emitted when the selected CRS is changed.
CrsOption
Predefined CRS options shown in widget.
@ CrsNotSet
Not set (hidden by default)
@ ProjectCrs
Current project CRS (if OTF reprojection enabled)
@ CurrentCrs
Current user selected CRS.
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
#define SIP_SKIP
Definition: qgis_sip.h:126
const QgsCoordinateReferenceSystem & crs