QGIS API Documentation 3.39.0-Master (3aed037ce22)
Loading...
Searching...
No Matches
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
45
46 QgsHistoryEntryNode( const QgsHistoryEntryNode &other ) = delete;
48
54 QgsHistoryEntryGroup *parent() { return mParent; }
55
59 virtual QVariant data( int role = Qt::DisplayRole ) const = 0;
60
64 virtual int childCount() const;
65
74 virtual QString html( const QgsHistoryWidgetContext &context ) const;
75
84 virtual QWidget *createWidget( const QgsHistoryWidgetContext &context ) SIP_FACTORY;
85
92 virtual bool doubleClicked( const QgsHistoryWidgetContext &context );
93
99 virtual void populateContextMenu( QMenu *menu, const QgsHistoryWidgetContext &context );
100
108 virtual bool matchesString( const QString &searchString ) const;
109
110 private:
111#ifdef SIP_RUN
113#endif
114
115 QgsHistoryEntryGroup *mParent = nullptr;
116
118
119};
120
121
129{
130 public:
131
134
137
143 void addChild( QgsHistoryEntryNode *child SIP_TRANSFER );
144
150 void insertChild( int index, QgsHistoryEntryNode *child SIP_TRANSFER );
151
157 int indexOf( QgsHistoryEntryNode *child ) const;
158
162 QgsHistoryEntryNode *childAt( int index );
163
167 void removeChildAt( int index );
168
172 void clear();
173
174 int childCount() const FINAL;
175
176 protected:
177 std::deque< std::unique_ptr< QgsHistoryEntryNode > > mChildren SIP_SKIP;
178
179 private:
180#ifdef SIP_RUN
182#endif
183
184
185};
186
187#endif // QGSHISTORYENTRYNODE_H
188
189
190
Base class for history entry "group" nodes, which contain children of their own.
QgsHistoryEntryGroup & operator=(const QgsHistoryEntryGroup &other)=delete
QgsHistoryEntryGroup()=default
QgsHistoryEntryGroup(const QgsHistoryEntryGroup &other)=delete
~QgsHistoryEntryGroup() override
Base class for nodes representing a QgsHistoryEntry.
QgsHistoryEntryNode & operator=(const QgsHistoryEntryNode &other)=delete
virtual ~QgsHistoryEntryNode()
virtual QVariant data(int role=Qt::DisplayRole) const =0
Returns the node's data for the specified model role.
QgsHistoryEntryNode()=default
QgsHistoryEntryNode(const QgsHistoryEntryNode &other)=delete
QgsHistoryEntryGroup * parent()
Returns the node's parent node.
Contains settings which reflect the context in which a history widget is shown, e....
#define SIP_SKIP
Definition qgis_sip.h:126
#define FINAL
Definition qgis_sip.h:242
#define SIP_TRANSFER
Definition qgis_sip.h:36
#define SIP_FACTORY
Definition qgis_sip.h:76