QGIS API Documentation 3.40.0-Bratislava (b56115d8743)
Loading...
Searching...
No Matches
qgshistoryentrymodel.h
Go to the documentation of this file.
1/***************************************************************************
2 qgshistoryentrymodel.h
3 --------------------------
4 begin : April 2023
5 copyright : (C) 2023 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************/
8/***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16#ifndef QGSHISTORYENTRYMODEL_H
17#define QGSHISTORYENTRYMODEL_H
18
19#include "qgis_gui.h"
20#include "qgis_sip.h"
21#include "qgis.h"
23#include <QAbstractItemModel>
24
25class QWidget;
26class QAction;
27
30class QgsHistoryEntry;
32class QgsHistoryEntryRootNode;
33
34class QgsHistoryEntryDateGroupNode;
35
42class GUI_EXPORT QgsHistoryEntryModel : public QAbstractItemModel
43{
44 Q_OBJECT
45
46 public:
47
58 QgsHistoryEntryModel( const QString &providerId = QString(),
60 QgsHistoryProviderRegistry *registry = nullptr,
62 QObject *parent SIP_TRANSFERTHIS = nullptr );
63
64 ~QgsHistoryEntryModel() override;
65 // Implementation of virtual functions from QAbstractItemModel
66
67 int rowCount( const QModelIndex &parent = QModelIndex() ) const final;
68 int columnCount( const QModelIndex &parent = QModelIndex() ) const final;
69 QModelIndex index( int row, int column, const QModelIndex &parent = QModelIndex() ) const final;
70 QModelIndex parent( const QModelIndex &child ) const final;
71 QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const override;
72 Qt::ItemFlags flags( const QModelIndex &index ) const override;
73
77 QgsHistoryEntryNode *index2node( const QModelIndex &index ) const;
78
79 private slots:
80
81 void entryAdded( long long id, const QgsHistoryEntry &entry, Qgis::HistoryProviderBackend backend );
82 void entryUpdated( long long id, const QVariantMap &entry, Qgis::HistoryProviderBackend backend );
83 void historyCleared( Qgis::HistoryProviderBackend backend, const QString &providerId );
84
85 private:
86
88 QModelIndex node2index( QgsHistoryEntryNode *node ) const;
89 QModelIndex indexOfParentNode( QgsHistoryEntryNode *parentNode ) const;
90
92
93 std::unique_ptr< QgsHistoryEntryRootNode > mRootNode;
94 QgsHistoryProviderRegistry *mRegistry = nullptr;
95 QString mProviderId;
97 QHash< long long, QgsHistoryEntryNode * > mIdToNodeHash;
98
99 friend class QgsHistoryEntryRootNode;
100};
101
102#endif // QGSHISTORYENTRYMODEL_H
103
104
105
HistoryProviderBackend
History provider backends.
Definition qgis.h:3246
@ LocalProfile
Local profile.
QFlags< HistoryProviderBackend > HistoryProviderBackends
Definition qgis.h:3251
Base class for history entry "group" nodes, which contain children of their own.
An item model representing history entries in a hierarchical tree structure.
Base class for nodes representing a QgsHistoryEntry.
Encapsulates a history entry.
The QgsHistoryProviderRegistry is a registry for objects which track user history (i....
Contains settings which reflect the context in which a history widget is shown, e....
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53