QGIS API Documentation 3.41.0-Master (af5edcb665c)
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:
44
45 QgsHistoryEntryNode( const QgsHistoryEntryNode &other ) = delete;
47
53 QgsHistoryEntryGroup *parent() { return mParent; }
54
58 virtual QVariant data( int role = Qt::DisplayRole ) const = 0;
59
63 virtual int childCount() const;
64
73 virtual QString html( const QgsHistoryWidgetContext &context ) const;
74
83 virtual QWidget *createWidget( const QgsHistoryWidgetContext &context ) SIP_FACTORY;
84
91 virtual bool doubleClicked( const QgsHistoryWidgetContext &context );
92
98 virtual void populateContextMenu( QMenu *menu, const QgsHistoryWidgetContext &context );
99
107 virtual bool matchesString( const QString &searchString ) const;
108
109 private:
110#ifdef SIP_RUN
112#endif
113
114 QgsHistoryEntryGroup *mParent = nullptr;
115
117};
118
119
127{
128 public:
131
134
140 void addChild( QgsHistoryEntryNode *child SIP_TRANSFER );
141
147 void insertChild( int index, QgsHistoryEntryNode *child SIP_TRANSFER );
148
154 int indexOf( QgsHistoryEntryNode *child ) const;
155
159 QgsHistoryEntryNode *childAt( int index );
160
164 void removeChildAt( int index );
165
169 void clear();
170
171 int childCount() const FINAL;
172
173 protected:
174 std::deque<std::unique_ptr<QgsHistoryEntryNode>> mChildren SIP_SKIP;
175
176 private:
177#ifdef SIP_RUN
179#endif
180};
181
182#endif // QGSHISTORYENTRYNODE_H
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