QGIS API Documentation 3.27.0-Master (0a97e3138f)
qgsprojectionselectiondialog.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsgenericprojectionselector.h
3 Set user defined projection using projection selector widget
4 -------------------
5 begin : May 28, 2004
6 copyright : (C) 2004 by Gary E.Sherman
7 email : sherman at mrcc.com
8 ***************************************************************************/
9
10/***************************************************************************
11 * *
12 * This program is free software; you can redistribute it and/or modify *
13 * it under the terms of the GNU General Public License as published by *
14 * the Free Software Foundation; either version 2 of the License, or *
15 * (at your option) any later version. *
16 * *
17 ***************************************************************************/
18#ifndef QGSGENERICPROJECTIONSELECTOR_H
19#define QGSGENERICPROJECTIONSELECTOR_H
20#include "ui_qgsgenericprojectionselectorbase.h"
21#include "qgis_sip.h"
22#include "qgsguiutils.h"
23
24#include <QSet>
25#include <QDialog>
26
27#include "qgis_gui.h"
29
30class QDialogButtonBox;
31
39class GUI_EXPORT QgsCrsSelectionWidget : public QgsPanelWidget, private Ui::QgsGenericProjectionSelectorBase
40{
41 Q_OBJECT
42 public:
43
47 QgsCrsSelectionWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr );
48
49 ~QgsCrsSelectionWidget() override;
50
56
60 void setMessage( const QString &message );
61
67 void setShowNoCrs( bool show );
68
74 bool showNoCrs() const;
75
83 void setNotSetText( const QString &text, const QString &description = QString() );
84
88 bool hasValidSelection() const;
89
90 public slots:
91
96 void setCrs( const QgsCoordinateReferenceSystem &crs );
97
110 void setOgcWmsCrsFilter( const QSet<QString> &crsFilter );
111
112 signals:
113
118
123
127 void hasValidSelectionChanged( bool isValid );
128
129 private:
130
134 enum class CrsType
135 {
136 Predefined,
137 Custom,
138 };
139
140 QString mNotSetText;
141 bool mShowNoCrsOption = false;
142 bool mDeferredInvalidCrsSet = false;
143 int mBlockSignals = 0;
144
145};
146
147
148
170class GUI_EXPORT QgsProjectionSelectionDialog : public QDialog
171{
172 Q_OBJECT
173 public:
174
178 QgsProjectionSelectionDialog( QWidget *parent SIP_TRANSFERTHIS = nullptr,
179 Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags );
180
187
193 void setMessage( const QString &message );
194
201 void showNoCrsForLayerMessage();
202
209 void setShowNoProjection( bool show );
210
217 bool showNoProjection() const;
218
228 void setNotSetText( const QString &text, const QString &description = QString() );
229
236 void setRequireValidSelection();
237
243 bool hasValidSelection() const;
244
245 public slots:
246
252 void setCrs( const QgsCoordinateReferenceSystem &crs );
253
266 void setOgcWmsCrsFilter( const QSet<QString> &crsFilter );
267
268 private slots:
269
270 void showHelp();
271
272 private:
273
274 QDialogButtonBox *mButtonBox = nullptr;
275 QgsCrsSelectionWidget *mCrsWidget = nullptr;
276
277 bool mRequireValidSelection = false;
278};
279
280#endif // #ifndef QGSLAYERCRSSELECTOR_H
This class represents a coordinate reference system (CRS).
A generic widget allowing users to pick a Coordinate Reference System (or define their own).
void hasValidSelectionChanged(bool isValid)
Emitted when the widget has a valid selection or not.
void crsDoubleClicked(const QgsCoordinateReferenceSystem &crs)
Emitted when a CRS entry in the widget is double-clicked.
void crsChanged()
Emitted when the CRS defined in the widget is changed.
Base class for any widget that can be shown as a inline panel.
A generic dialog to prompt the user for a Coordinate Reference System.
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
const QgsCoordinateReferenceSystem & crs