QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
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
49 {
50 RoleExtent = Qt::UserRole,
55 };
56
70
76 QgsBookmarkManagerModel( QgsBookmarkManager *manager, QgsBookmarkManager *projectManager = nullptr, QObject *parent SIP_TRANSFERTHIS = nullptr );
77
78 int rowCount( const QModelIndex &parent = QModelIndex() ) const override;
79 int columnCount( const QModelIndex &parent = QModelIndex() ) const override;
80 QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const override;
81 Qt::ItemFlags flags( const QModelIndex &index ) const override;
82 bool setData( const QModelIndex &index, const QVariant &value, int role = Qt::EditRole ) override;
83 bool insertRows( int row, int count, const QModelIndex &parent = QModelIndex() ) override;
84 bool removeRows( int row, int count, const QModelIndex &parent = QModelIndex() ) override;
85 QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const override;
86
87 private slots:
88 void bookmarkAboutToBeAdded( const QString &id );
89 void bookmarkAdded( const QString &id );
90 void bookmarkAboutToBeRemoved( const QString &id );
91 void bookmarkRemoved( const QString &id );
92 void bookmarkChanged( const QString &id );
93
94 private:
95 bool mBlocked = false;
96 QgsBookmarkManager *mManager = nullptr;
97 QgsBookmarkManager *mProjectManager = nullptr;
98 QgsBookmark bookmarkForIndex( const QModelIndex &index ) const;
99
100};
101
110class CORE_EXPORT QgsBookmarkManagerProxyModel : public QSortFilterProxyModel
111{
112 Q_OBJECT
113
114 public:
115
121 QgsBookmarkManagerProxyModel( QgsBookmarkManager *manager, QgsBookmarkManager *projectManager = nullptr, QObject *parent SIP_TRANSFERTHIS = nullptr );
122
123 private:
124
125 QgsBookmarkManagerModel *mModel = nullptr;
126};
127
128#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.
CustomRoles
Custom model roles.
@ RoleRotation
Bookmark map rotation.
@ RoleGroup
Bookmark group.
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