QGIS API Documentation 3.32.0-Lima (311a8cb8a6)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 : denis.rouzaud@gmail.com
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
30class QgsMapLayer;
33class QLabel;
34
41class GUI_EXPORT QgsProjectionSelectionWidget : public QWidget
42{
43 Q_OBJECT
44 public:
45
50 {
57 };
58
60 explicit QgsProjectionSelectionWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr );
61
67
74 void setOptionVisible( CrsOption option, bool visible );
75
81 bool optionVisible( CrsOption option ) const;
82
88 void setNotSetText( const QString &text );
89
96 void setMessage( const QString &text );
97
104 static QString crsOptionText( const QgsCoordinateReferenceSystem &crs ) SIP_SKIP;
105
113 bool showAccuracyWarnings() const;
114
122 void setShowAccuracyWarnings( bool show );
123
133 void setSourceEnsemble( const QString &ensemble );
134
144 QString sourceEnsemble() const;
145
151 void setDialogTitle( const QString &title );
152
158 QString dialogTitle() const;
159
165 void setFilter( const QList< QgsCoordinateReferenceSystem > &crses );
166
167 signals:
168
173
178 void cleared();
179
180 public slots:
181
186 void setCrs( const QgsCoordinateReferenceSystem &crs );
187
193 void setLayerCrs( const QgsCoordinateReferenceSystem &crs );
194
198 void selectCrs();
199
200 protected:
201
202 void dragEnterEvent( QDragEnterEvent *event ) override;
203 void dragLeaveEvent( QDragLeaveEvent *event ) override;
204 void dropEvent( QDropEvent *event ) override;
205
206 private:
207
212 QgsHighlightableComboBox *mCrsComboBox = nullptr;
213 QToolButton *mButton = nullptr;
214 QString mNotSetText;
215 QString mMessage;
216
217 bool mShowAccuracyWarnings = false;
218 QString mSourceEnsemble;
219
220 QWidget *mWarningLabelContainer = nullptr;
221 QLabel *mWarningLabel = nullptr;
222
223 QPointer< QgsCrsSelectionWidget > mActivePanel;
224 int mIgnorePanelSignals = 0;
225
226 QString mDialogTitle;
227
228 QList<QgsCoordinateReferenceSystem> mFilter;
229
230 void addNotSetOption();
231 void addProjectCrsOption();
232 void addDefaultCrsOption();
233 void addCurrentCrsOption();
234
235 void addRecentCrs();
236 bool crsIsShown( long srsid ) const;
237
238 int firstRecentCrsIndex() const;
239 void updateTooltip();
240
241 QgsMapLayer *mapLayerFromMimeData( const QMimeData *data ) const;
242 QgsCoordinateReferenceSystem crsAtIndex( int index ) const;
243
244 private slots:
245
246 void comboIndexChanged( int idx );
247 void updateWarning();
248
249};
250
251#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