QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
Loading...
Searching...
No Matches
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
30class QgsMapLayer;
33class QLabel;
34class QgsMapLayer;
35
42class GUI_EXPORT QgsProjectionSelectionWidget : public QWidget
43{
44 Q_OBJECT
45 public:
46
59
61 explicit QgsProjectionSelectionWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr );
62
68
75 void setOptionVisible( CrsOption option, bool visible );
76
82 bool optionVisible( CrsOption option ) const;
83
89 void setNotSetText( const QString &text );
90
97 void setMessage( const QString &text );
98
105 static QString crsOptionText( const QgsCoordinateReferenceSystem &crs ) SIP_SKIP;
106
114 bool showAccuracyWarnings() const;
115
123 void setShowAccuracyWarnings( bool show );
124
134 void setSourceEnsemble( const QString &ensemble );
135
145 QString sourceEnsemble() const;
146
152 void setDialogTitle( const QString &title );
153
159 QString dialogTitle() const;
160
166 void setFilter( const QList< QgsCoordinateReferenceSystem > &crses );
167
168 signals:
169
174
179 void cleared();
180
181 public slots:
182
187 void setCrs( const QgsCoordinateReferenceSystem &crs );
188
194 void setLayerCrs( const QgsCoordinateReferenceSystem &crs );
195
199 void selectCrs();
200
201 protected:
202
203 void dragEnterEvent( QDragEnterEvent *event ) override;
204 void dragLeaveEvent( QDragLeaveEvent *event ) override;
205 void dropEvent( QDropEvent *event ) override;
206
207 private:
208
213 QgsHighlightableComboBox *mCrsComboBox = nullptr;
214 QToolButton *mButton = nullptr;
215 QString mNotSetText;
216 QString mMessage;
217
218 bool mShowAccuracyWarnings = false;
219 QString mSourceEnsemble;
220
221 QWidget *mWarningLabelContainer = nullptr;
222 QLabel *mWarningLabel = nullptr;
223
224 QPointer< QgsCrsSelectionWidget > mActivePanel;
225 int mIgnorePanelSignals = 0;
226
227 QString mDialogTitle;
228
229 QList<QgsCoordinateReferenceSystem> mFilter;
230
231 void addNotSetOption();
232 void addProjectCrsOption();
233 void addDefaultCrsOption();
234 void addCurrentCrsOption();
235
236 void addRecentCrs();
237 bool crsIsShown( long srsid ) const;
238
239 int firstRecentCrsIndex() const;
240 void updateTooltip();
241
242 QgsMapLayer *mapLayerFromMimeData( const QMimeData *data ) const;
243 QgsCoordinateReferenceSystem crsAtIndex( int index ) const;
244
245 private slots:
246
247 void comboIndexChanged( int idx );
248 void updateWarning();
249
250};
251
252#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:74
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