QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
gui
proj
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.h
"
21
#include "qgis_gui.h"
22
#include "
qgis_sip.h
"
23
#include "
qgscoordinatereferencesystemmodel.h
"
24
25
#include <QAbstractItemModel>
26
#include <QIcon>
27
#include <QSortFilterProxyModel>
28
29
class
QgsCoordinateReferenceSystem
;
30
37
class
GUI_EXPORT
QgsRecentCoordinateReferenceSystemsModel
:
public
QAbstractItemModel
38
{
39
Q_OBJECT
40
41
public
:
42
// *INDENT-OFF*
43
47
enum class
CustomRole
SIP_MONKEYPATCH_SCOPEENUM_UNNEST
(
QgsRecentCoordinateReferenceSystemsModel
, Roles ) : int
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
92
class
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
133
QgsCoordinateReferenceSystemProxyModel::Filters
filters
()
const
{
return
mFilters; }
134
135
bool
filterAcceptsRow(
int
sourceRow,
const
QModelIndex &sourceParent )
const override
;
136
142
QgsCoordinateReferenceSystem
crs(
const
QModelIndex &index )
const
;
143
144
private
:
145
QgsRecentCoordinateReferenceSystemsModel
*mModel =
nullptr
;
146
QgsCoordinateReferenceSystemProxyModel::Filters
mFilters =
QgsCoordinateReferenceSystemProxyModel::Filters
();
147
bool
mFilterDeprecated =
false
;
148
QString mFilterString;
149
};
150
151
152
#endif
// QGSRECENTCOORDINATEREFERENCESYSTEMSMODEL_H
QgsCoordinateReferenceSystemProxyModel::Filters
QFlags< Filter > Filters
Definition
qgscoordinatereferencesystemmodel.h:347
QgsCoordinateReferenceSystem
Represents a coordinate reference system (CRS).
Definition
qgscoordinatereferencesystem.h:216
QgsRecentCoordinateReferenceSystemsModel
A model for display of recently used coordinate reference systems.
Definition
qgsrecentcoordinatereferencesystemsmodel.h:38
QgsRecentCoordinateReferenceSystemsModel::QgsRecentCoordinateReferenceSystemsModel
QgsRecentCoordinateReferenceSystemsModel(QObject *parent=nullptr, int subclassColumnCount=1)
Constructor for QgsRecentCoordinateReferenceSystemsModel, with the specified parent object.
Definition
qgsrecentcoordinatereferencesystemsmodel.cpp:30
QgsRecentCoordinateReferenceSystemsModel::CustomRole
CustomRole
Custom model roles.
Definition
qgsrecentcoordinatereferencesystemsmodel.h:48
QgsRecentCoordinateReferenceSystemsProxyModel::setFilters
void setFilters(QgsCoordinateReferenceSystemProxyModel::Filters filters)
Set filters that affect how CRS are filtered.
Definition
qgsrecentcoordinatereferencesystemsmodel.cpp:177
QgsRecentCoordinateReferenceSystemsProxyModel::filters
QgsCoordinateReferenceSystemProxyModel::Filters filters() const
Returns any filters that affect how CRS are filtered.
Definition
qgsrecentcoordinatereferencesystemsmodel.h:133
QgsRecentCoordinateReferenceSystemsProxyModel::QgsRecentCoordinateReferenceSystemsProxyModel
QgsRecentCoordinateReferenceSystemsProxyModel(QObject *parent=nullptr, int subclassColumnCount=1)
Constructor for QgsRecentCoordinateReferenceSystemsProxyModel, with the given parent object.
Definition
qgsrecentcoordinatereferencesystemsmodel.cpp:159
QgsRecentCoordinateReferenceSystemsProxyModel::setFilterString
void setFilterString(const QString &filter)
Sets a filter string, such that only coordinate reference systems matching the specified string will ...
Definition
qgsrecentcoordinatereferencesystemsmodel.cpp:195
QgsRecentCoordinateReferenceSystemsProxyModel::setFilterDeprecated
void setFilterDeprecated(bool filter)
Sets whether deprecated CRS should be filtered from the results.
Definition
qgsrecentcoordinatereferencesystemsmodel.cpp:186
QgsRecentCoordinateReferenceSystemsProxyModel::recentCoordinateReferenceSystemsModel
QgsRecentCoordinateReferenceSystemsModel * recentCoordinateReferenceSystemsModel()
Returns the underlying source model.
Definition
qgsrecentcoordinatereferencesystemsmodel.cpp:167
qgis.h
qgis_sip.h
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition
qgis_sip.h:52
SIP_SKIP
#define SIP_SKIP
Definition
qgis_sip.h:138
SIP_MONKEYPATCH_SCOPEENUM_UNNEST
#define SIP_MONKEYPATCH_SCOPEENUM_UNNEST(OUTSIDE_CLASS, FORMERNAME)
Definition
qgis_sip.h:270
SIP_PYARGREMOVE
#define SIP_PYARGREMOVE
Definition
qgis_sip.h:163
SIP_MONKEYPATCH_COMPAT_NAME
#define SIP_MONKEYPATCH_COMPAT_NAME(FORMERNAME)
Definition
qgis_sip.h:272
qgscoordinatereferencesystemmodel.h
Generated on
for QGIS API Documentation by
1.17.0