QGIS API Documentation 3.41.0-Master (45a0abf3bec)
Loading...
Searching...
No Matches
qgsrecentcoordinatereferencesystemsmodel.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsrecentcoordinatereferencesystemsmodel.h
3 -------------------
4 begin : January 2024
5 copyright : (C) 2024 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17#ifndef QGSRECENTCOORDINATEREFERENCESYSTEMSMODEL_H
18#define QGSRECENTCOORDINATEREFERENCESYSTEMSMODEL_H
19
20#include "qgis_gui.h"
21#include "qgis_sip.h"
22#include "qgis.h"
24
25#include <QAbstractItemModel>
26#include <QSortFilterProxyModel>
27#include <QIcon>
28
30
37class GUI_EXPORT QgsRecentCoordinateReferenceSystemsModel : public QAbstractItemModel
38{
39 Q_OBJECT
40
41 public:
42
43 // *INDENT-OFF*
44
49 {
50 Crs SIP_MONKEYPATCH_COMPAT_NAME(RoleCrs) = Qt::UserRole,
51 AuthId SIP_MONKEYPATCH_COMPAT_NAME(RoleAuthId),
52 };
53 Q_ENUM( CustomRole )
54 // *INDENT-ON*
55
56
59 QgsRecentCoordinateReferenceSystemsModel( QObject *parent SIP_TRANSFERTHIS = nullptr, int subclassColumnCount SIP_PYARGREMOVE = 1 );
60
61 Qt::ItemFlags flags( const QModelIndex &index ) const override;
62 QVariant data( const QModelIndex &index, int role ) const override;
63 int rowCount( const QModelIndex &parent = QModelIndex() ) const override;
64 int columnCount( const QModelIndex & = QModelIndex() ) const override;
65 QModelIndex index( int row, int column, const QModelIndex &parent = QModelIndex() ) const override;
66 QModelIndex parent( const QModelIndex &index ) const override;
67
73 QgsCoordinateReferenceSystem crs( const QModelIndex &index ) const;
74
75 private slots:
76
77 void recentCrsPushed( const QgsCoordinateReferenceSystem &crs );
78 void recentCrsRemoved( const QgsCoordinateReferenceSystem &crs );
79 void recentCrsCleared();
80
81 private:
82
83 QList< QgsCoordinateReferenceSystem > mCrs;
84 int mColumnCount = 1;
85
86};
87
88
95class GUI_EXPORT QgsRecentCoordinateReferenceSystemsProxyModel: public QSortFilterProxyModel
96{
97 Q_OBJECT
98
99 public:
100
104 explicit QgsRecentCoordinateReferenceSystemsProxyModel( QObject *parent SIP_TRANSFERTHIS = nullptr, int subclassColumnCount SIP_PYARGREMOVE = 1 );
105
109 QgsRecentCoordinateReferenceSystemsModel *recentCoordinateReferenceSystemsModel();
110
115 const QgsRecentCoordinateReferenceSystemsModel *recentCoordinateReferenceSystemsModel() const SIP_SKIP;
116
120 void setFilters( QgsCoordinateReferenceSystemProxyModel::Filters filters );
121
125 void setFilterDeprecated( bool filter );
126
131 void setFilterString( const QString &filter );
132
138
139 bool filterAcceptsRow( int sourceRow, const QModelIndex &sourceParent ) const override;
140
146 QgsCoordinateReferenceSystem crs( const QModelIndex &index ) const;
147
148 private:
149
152 bool mFilterDeprecated = false;
153 QString mFilterString;
154};
155
156
157#endif // QGSRECENTCOORDINATEREFERENCESYSTEMSMODEL_H
This class represents a coordinate reference system (CRS).
A model for display of recently used coordinate reference systems.
A sort/filter proxy model for recent coordinate reference systems.
QgsCoordinateReferenceSystemProxyModel::Filters filters() const
Returns any filters that affect how CRS are filtered.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_SKIP
Definition qgis_sip.h:126
#define SIP_MONKEYPATCH_SCOPEENUM_UNNEST(OUTSIDE_CLASS, FORMERNAME)
Definition qgis_sip.h:271
#define SIP_PYARGREMOVE
Definition qgis_sip.h:151
#define SIP_MONKEYPATCH_COMPAT_NAME(FORMERNAME)
Definition qgis_sip.h:273
const QgsCoordinateReferenceSystem & crs