QGIS API Documentation 3.41.0-Master (af5edcb665c)
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 // *INDENT-OFF*
43
48 {
49 Crs SIP_MONKEYPATCH_COMPAT_NAME( RoleCrs ) = Qt::UserRole,
50 AuthId SIP_MONKEYPATCH_COMPAT_NAME( RoleAuthId ),
51 };
52 Q_ENUM( CustomRole )
53 // *INDENT-ON*
54
55
58 QgsRecentCoordinateReferenceSystemsModel( QObject *parent SIP_TRANSFERTHIS = nullptr, int subclassColumnCount SIP_PYARGREMOVE = 1 );
59
60 Qt::ItemFlags flags( const QModelIndex &index ) const override;
61 QVariant data( const QModelIndex &index, int role ) const override;
62 int rowCount( const QModelIndex &parent = QModelIndex() ) const override;
63 int columnCount( const QModelIndex & = QModelIndex() ) const override;
64 QModelIndex index( int row, int column, const QModelIndex &parent = QModelIndex() ) const override;
65 QModelIndex parent( const QModelIndex &index ) const override;
66
72 QgsCoordinateReferenceSystem crs( const QModelIndex &index ) const;
73
74 private slots:
75
76 void recentCrsPushed( const QgsCoordinateReferenceSystem &crs );
77 void recentCrsRemoved( const QgsCoordinateReferenceSystem &crs );
78 void recentCrsCleared();
79
80 private:
81 QList<QgsCoordinateReferenceSystem> mCrs;
82 int mColumnCount = 1;
83};
84
85
92class GUI_EXPORT QgsRecentCoordinateReferenceSystemsProxyModel : public QSortFilterProxyModel
93{
94 Q_OBJECT
95
96 public:
100 explicit QgsRecentCoordinateReferenceSystemsProxyModel( QObject *parent SIP_TRANSFERTHIS = nullptr, int subclassColumnCount SIP_PYARGREMOVE = 1 );
101
105 QgsRecentCoordinateReferenceSystemsModel *recentCoordinateReferenceSystemsModel();
106
111 const QgsRecentCoordinateReferenceSystemsModel *recentCoordinateReferenceSystemsModel() const SIP_SKIP;
112
116 void setFilters( QgsCoordinateReferenceSystemProxyModel::Filters filters );
117
121 void setFilterDeprecated( bool filter );
122
127 void setFilterString( const QString &filter );
128
134
135 bool filterAcceptsRow( int sourceRow, const QModelIndex &sourceParent ) const override;
136
142 QgsCoordinateReferenceSystem crs( const QModelIndex &index ) const;
143
144 private:
147 bool mFilterDeprecated = false;
148 QString mFilterString;
149};
150
151
152#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