QGIS API Documentation 3.41.0-Master (cea29feecf2)
Loading...
Searching...
No Matches
qgsprojectionselectiontreewidget.h
Go to the documentation of this file.
1/***************************************************************************
2 * qgsprojectionselector.h *
3 * Copyright (C) 2005 by Tim Sutton *
5 * *
6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. *
10 ***************************************************************************/
11#ifndef QGSCRSSELECTOR_H
12#define QGSCRSSELECTOR_H
13
14#include "ui_qgsprojectionselectorbase.h"
15
16#include <QSet>
17#include <QStringList>
18
19#include "qgis_sip.h"
20#include "qgis_gui.h"
24
25#include <QIdentityProxyModel>
26#include <QStyledItemDelegate>
27
28class QResizeEvent;
29class QTreeWidgetItem;
30
32// proxy to expand base recent crs model to three column model
33class QgsRecentCoordinateReferenceSystemTableModel : public QgsRecentCoordinateReferenceSystemsProxyModel SIP_SKIP
34{
35 Q_OBJECT
36 public:
37 QgsRecentCoordinateReferenceSystemTableModel( QObject *parent );
38 QVariant headerData( int section, Qt::Orientation orientation, int role ) const override;
39 QVariant data( const QModelIndex &index, int role ) const override;
40};
41
42class RemoveRecentCrsDelegate : public QStyledItemDelegate SIP_SKIP
43{
44 Q_OBJECT
45
46 public:
47 RemoveRecentCrsDelegate( QObject *parent );
48 bool eventFilter( QObject *obj, QEvent *event ) override;
49
50 protected:
51 void paint( QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index ) const override;
52
53 private:
54 void setHoveredIndex( const QModelIndex &index );
55
56 QModelIndex mHoveredIndex;
57};
58
59
61
75class GUI_EXPORT QgsProjectionSelectionTreeWidget : public QWidget, private Ui::QgsProjectionSelectorBase
76{
77 Q_OBJECT
78
79 public:
88
90
96
102 void setShowNoProjection( bool show );
103
108 void setShowBoundsMap( bool show );
109
115 bool showNoProjection() const;
116
122 void setNotSetText( const QString &text );
123
128 bool showBoundsMap() const;
129
136 bool hasValidSelection() const;
137
142 QgsRectangle previewRect() const;
143
151
158 void setFilters( QgsCoordinateReferenceSystemProxyModel::Filters filters );
159
160 public slots:
161
166 void setCrs( const QgsCoordinateReferenceSystem &crs );
167
172 void setPreviewRect( const QgsRectangle &rect );
173
183 void setOgcWmsCrsFilter( const QSet<QString> &crsFilter );
184
190 Q_DECL_DEPRECATED void pushProjectionToFront() SIP_DEPRECATED;
191
197 void clearRecentCrs();
198
199 signals:
200
205
210 Q_DECL_DEPRECATED void initialized() SIP_DEPRECATED;
211
215 void projectionDoubleClicked();
216
222 void hasValidSelectionChanged( bool isValid );
223
224 protected:
225 // Used to manage column sizes
226 void resizeEvent( QResizeEvent *event ) override;
227
228 // Used to catch key presses on the recent projections list
229 bool eventFilter( QObject *obj, QEvent *ev ) override;
230
231 private:
232 void loadUnknownCrs( const QgsCoordinateReferenceSystem &crs );
233
234 void selectCrsByAuthId( const QString &authid );
235
236 enum Roles
237 {
238 RoleDeprecated = Qt::UserRole,
239 RoleWkt,
240 RoleProj
241 };
242
243 QgsCoordinateReferenceSystemProxyModel *mCrsModel = nullptr;
244 QgsRecentCoordinateReferenceSystemTableModel *mRecentCrsModel = nullptr;
245
246 enum Columns
247 {
248 NameColumn,
249 AuthidColumn,
250 ClearColumn
251 };
252
253 bool mShowMap = true;
254
255 bool mBlockSignals = false;
256
257 private slots:
258
259 void updateBoundsPreview();
260
262 void lstCoordinateSystemsDoubleClicked( const QModelIndex &index );
263 void lstRecentDoubleClicked( const QModelIndex &index );
264 void lstRecentClicked( const QModelIndex &index );
265 void lstCoordinateSystemsSelectionChanged( const QItemSelection &selected, const QItemSelection &deselected );
266 void lstRecentSelectionChanged( const QItemSelection &selected, const QItemSelection &deselected );
267
268 void removeRecentCrsItem( const QModelIndex &index );
269};
270
271#endif
A sort/filter proxy model for coordinate reference systems.
@ FilterHorizontal
Include horizontal CRS (excludes compound CRS containing a horizontal component)
This class represents a coordinate reference system (CRS).
A widget for selecting a coordinate reference system from a tree.
void crsSelected()
Emitted when a projection is selected in the widget.
Q_DECL_DEPRECATED void initialized()
Notifies others that the widget is now fully initialized, including deferred selection of projection.
A sort/filter proxy model for recent coordinate reference systems.
A rectangle specified with double values.
#define SIP_DEPRECATED
Definition qgis_sip.h:106
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_SKIP
Definition qgis_sip.h:126
const QgsCoordinateReferenceSystem & crs