QGIS API Documentation 3.32.0-Lima (311a8cb8a6)
qgshistoryentrynode.h
Go to the documentation of this file.
1/***************************************************************************
2 qgshistoryentrynode.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 QGSHISTORYENTRYNODE_H
17#define QGSHISTORYENTRYNODE_H
18
19#include "qgis_gui.h"
20#include "qgis_sip.h"
21#include "qgis.h"
22#include <QString>
23#include <QVariantMap>
24#include <memory>
25#include <deque>
26
27class QWidget;
28class QAction;
29class QMenu;
32
39class GUI_EXPORT QgsHistoryEntryNode
40{
41 public:
42
48
50 QgsHistoryEntryNode( const QgsHistoryEntryNode &other ) = delete;
53
59 QgsHistoryEntryGroup *parent() { return mParent; }
60
64 virtual QVariant data( int role = Qt::DisplayRole ) const = 0;
65
69 virtual int childCount() const;
70
79 virtual QString html( const QgsHistoryWidgetContext &context ) const;
80
89 virtual QWidget *createWidget( const QgsHistoryWidgetContext &context ) SIP_FACTORY;
90
97 virtual bool doubleClicked( const QgsHistoryWidgetContext &context );
98
104 virtual void populateContextMenu( QMenu *menu, const QgsHistoryWidgetContext &context );
105
113 virtual bool matchesString( const QString &searchString ) const;
114
115 private:
116#ifdef SIP_RUN
118#endif
119
120 QgsHistoryEntryGroup *mParent = nullptr;
121
123
124};
125
126
134{
135 public:
136
140
145
151 void addChild( QgsHistoryEntryNode *child SIP_TRANSFER );
152
158 void insertChild( int index, QgsHistoryEntryNode *child SIP_TRANSFER );
159
165 int indexOf( QgsHistoryEntryNode *child ) const;
166
170 QgsHistoryEntryNode *childAt( int index );
171
175 void removeChildAt( int index );
176
180 void clear();
181
182 int childCount() const FINAL;
183
184 protected:
185 std::deque< std::unique_ptr< QgsHistoryEntryNode > > mChildren SIP_SKIP;
186
187 private:
188#ifdef SIP_RUN
190#endif
191
192
193};
194
195#endif // QGSHISTORYENTRYNODE_H
196
197
198
Base class for history entry "group" nodes, which contain children of their own.
QgsHistoryEntryGroup & operator=(const QgsHistoryEntryGroup &other)=delete
QgsHistoryEntryGroup cannot be copied.
QgsHistoryEntryGroup()=default
Constructor for QgsHistoryEntryGroup.
QgsHistoryEntryGroup(const QgsHistoryEntryGroup &other)=delete
QgsHistoryEntryGroup cannot be copied.
~QgsHistoryEntryGroup() override
Base class for nodes representing a QgsHistoryEntry.
QgsHistoryEntryNode & operator=(const QgsHistoryEntryNode &other)=delete
QgsHistoryEntryNode cannot be copied.
virtual ~QgsHistoryEntryNode()
virtual QVariant data(int role=Qt::DisplayRole) const =0
Returns the node's data for the specified model role.
QgsHistoryEntryNode()=default
Constructor for QgsHistoryEntryNode.
QgsHistoryEntryNode(const QgsHistoryEntryNode &other)=delete
QgsHistoryEntryNode cannot be copied.
QgsHistoryEntryGroup * parent()
Returns the node's parent node.
Contains settings which reflect the context in which a history widget is shown, e....
std::unique_ptr< GEOSGeometry, GeosDeleter > unique_ptr
Scoped GEOS pointer.
Definition: qgsgeos.h:74
#define SIP_SKIP
Definition: qgis_sip.h:126
#define FINAL
Definition: qgis_sip.h:237
#define SIP_TRANSFER
Definition: qgis_sip.h:36
#define SIP_FACTORY
Definition: qgis_sip.h:76