QGIS API Documentation 3.99.0-Master (2fe06baccd8)
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
22#include <QAbstractTableModel>
23#include <QSortFilterProxyModel>
24
26class QgsBookmark;
27
42class CORE_EXPORT QgsBookmarkManagerModel: public QAbstractTableModel
43{
44 Q_OBJECT
45
46 public:
47
48 // *INDENT-OFF*
49
57 {
58 Extent SIP_MONKEYPATCH_COMPAT_NAME(RoleExtent) = Qt::UserRole,
61 Group SIP_MONKEYPATCH_COMPAT_NAME(RoleGroup),
62 Rotation SIP_MONKEYPATCH_COMPAT_NAME(RoleRotation),
63 };
64 Q_ENUM( CustomRole )
65 // *INDENT-ON*
66
67
80
86 QgsBookmarkManagerModel( QgsBookmarkManager *manager, QgsBookmarkManager *projectManager = nullptr, QObject *parent SIP_TRANSFERTHIS = nullptr );
87
88 int rowCount( const QModelIndex &parent = QModelIndex() ) const override;
89 int columnCount( const QModelIndex &parent = QModelIndex() ) const override;
90 QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const override;
91 Qt::ItemFlags flags( const QModelIndex &index ) const override;
92 bool setData( const QModelIndex &index, const QVariant &value, int role = Qt::EditRole ) override;
93 bool insertRows( int row, int count, const QModelIndex &parent = QModelIndex() ) override;
94 bool removeRows( int row, int count, const QModelIndex &parent = QModelIndex() ) override;
95 QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const override;
96
97 private slots:
98 void bookmarkAboutToBeAdded( const QString &id );
99 void bookmarkAdded( const QString &id );
100 void bookmarkAboutToBeRemoved( const QString &id );
101 void bookmarkRemoved( const QString &id );
102 void bookmarkChanged( const QString &id );
103
104 private:
105 bool mBlocked = false;
106 QgsBookmarkManager *mManager = nullptr;
107 QgsBookmarkManager *mProjectManager = nullptr;
108 QgsBookmark bookmarkForIndex( const QModelIndex &index ) const;
109
110};
111
120class CORE_EXPORT QgsBookmarkManagerProxyModel : public QSortFilterProxyModel
121{
122 Q_OBJECT
123
124 public:
125
131 QgsBookmarkManagerProxyModel( QgsBookmarkManager *manager, QgsBookmarkManager *projectManager = nullptr, QObject *parent SIP_TRANSFERTHIS = nullptr );
132
133 private:
134
135 QgsBookmarkManagerModel *mModel = nullptr;
136};
137
138#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.
QgsBookmarkManagerModel(QgsBookmarkManager *manager, QgsBookmarkManager *projectManager=nullptr, QObject *parent=nullptr)
Constructor for QgsBookmarkManagerModel, associated with a main manager (usually the application book...
CustomRole
Custom model roles.
QgsBookmarkManagerProxyModel(QgsBookmarkManager *manager, QgsBookmarkManager *projectManager=nullptr, QObject *parent=nullptr)
Constructor for QgsBookmarkManagerProxyModel, associated with a main manager (usually the application...
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:268
#define SIP_MONKEYPATCH_COMPAT_NAME(FORMERNAME)
Definition qgis_sip.h:270