QGIS API Documentation 3.41.0-Master (45a0abf3bec)
Loading...
Searching...
No Matches
qgsbookmarkmodel.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsbookmarkmodel.h
3 ------------------
4 Date : Septemeber 2019
5 Copyright : (C) 2019 Nyall Dawson
6 Email : nyall dot dawson at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#ifndef QGSBOOKMARKMODEL_H
17#define QGSBOOKMARKMODEL_H
18
19#include "qgis_core.h"
20#include "qgis_sip.h"
21#include <QAbstractTableModel>
22#include <QSortFilterProxyModel>
23
25class QgsBookmark;
26
41class CORE_EXPORT QgsBookmarkManagerModel: public QAbstractTableModel
42{
43 Q_OBJECT
44
45 public:
46
47 // *INDENT-OFF*
48
56 {
57 Extent SIP_MONKEYPATCH_COMPAT_NAME(RoleExtent) = Qt::UserRole,
58 Name SIP_MONKEYPATCH_COMPAT_NAME(RoleName),
60 Group SIP_MONKEYPATCH_COMPAT_NAME(RoleGroup),
61 Rotation SIP_MONKEYPATCH_COMPAT_NAME(RoleRotation),
62 };
63 Q_ENUM( CustomRole )
64 // *INDENT-ON*
65
66
79
85 QgsBookmarkManagerModel( QgsBookmarkManager *manager, QgsBookmarkManager *projectManager = nullptr, QObject *parent SIP_TRANSFERTHIS = nullptr );
86
87 int rowCount( const QModelIndex &parent = QModelIndex() ) const override;
88 int columnCount( const QModelIndex &parent = QModelIndex() ) const override;
89 QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const override;
90 Qt::ItemFlags flags( const QModelIndex &index ) const override;
91 bool setData( const QModelIndex &index, const QVariant &value, int role = Qt::EditRole ) override;
92 bool insertRows( int row, int count, const QModelIndex &parent = QModelIndex() ) override;
93 bool removeRows( int row, int count, const QModelIndex &parent = QModelIndex() ) override;
94 QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const override;
95
96 private slots:
97 void bookmarkAboutToBeAdded( const QString &id );
98 void bookmarkAdded( const QString &id );
99 void bookmarkAboutToBeRemoved( const QString &id );
100 void bookmarkRemoved( const QString &id );
101 void bookmarkChanged( const QString &id );
102
103 private:
104 bool mBlocked = false;
105 QgsBookmarkManager *mManager = nullptr;
106 QgsBookmarkManager *mProjectManager = nullptr;
107 QgsBookmark bookmarkForIndex( const QModelIndex &index ) const;
108
109};
110
119class CORE_EXPORT QgsBookmarkManagerProxyModel : public QSortFilterProxyModel
120{
121 Q_OBJECT
122
123 public:
124
130 QgsBookmarkManagerProxyModel( QgsBookmarkManager *manager, QgsBookmarkManager *projectManager = nullptr, QObject *parent SIP_TRANSFERTHIS = nullptr );
131
132 private:
133
134 QgsBookmarkManagerModel *mModel = nullptr;
135};
136
137#endif // QGSBOOKMARKMODEL_H
Implements a model for the contents of QgsBookmarkManager objects.
@ ColumnXMin
Extent x-minimum.
@ ColumnRotation
Rotation of the map.
@ ColumnYMin
Extent y-minimum.
@ ColumnStore
Manager storing the bookmark (true if stored in project bookmark manager)
@ ColumnXMax
Extent x-maximum.
@ ColumnYMax
Extent y-maximum.
CustomRole
Custom model roles.
A QSortFilterProxyModel subclass for sorting the entries in a QgsBookmarkManagerModel.
Manages storage of a set of bookmarks.
Represents a spatial bookmark, with a name, CRS and extent.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_MONKEYPATCH_SCOPEENUM_UNNEST(OUTSIDE_CLASS, FORMERNAME)
Definition qgis_sip.h:271
#define SIP_MONKEYPATCH_COMPAT_NAME(FORMERNAME)
Definition qgis_sip.h:273