Skip to content

Commit 0774c80

Browse files
committedApr 22, 2023
Add capacity for history providers to create/update nodes
1 parent dd25f39 commit 0774c80

File tree

3 files changed

+35
-4
lines changed

3 files changed

+35
-4
lines changed
 

‎python/gui/auto_generated/history/qgshistoryprovider.sip.in

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,20 @@ Abstract base class for objects which track user history (i.e. operations perfor
3636
virtual QString id() const = 0;
3737
%Docstring
3838
Returns the provider's unique id, which is used to associate existing history entries with the provider.
39+
%End
40+
41+
virtual QgsHistoryEntryNode *createNodeForEntry( const QVariantMap &entry ) /Factory/;
42+
%Docstring
43+
Creates a new history node for the given ``entry``.
44+
45+
.. versionadded:: 3.32
46+
%End
47+
48+
virtual void updateNodeForEntry( QgsHistoryEntryNode *node, const QVariantMap &entry );
49+
%Docstring
50+
Updates an existing history ``node`` for the given ``entry``.
51+
52+
.. versionadded:: 3.32
3953
%End
4054

4155
};

‎src/gui/history/qgshistoryprovider.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,13 @@
1717
#include "qgshistoryprovider.h"
1818

1919
QgsAbstractHistoryProvider::~QgsAbstractHistoryProvider() = default;
20+
21+
QgsHistoryEntryNode *QgsAbstractHistoryProvider::createNodeForEntry( const QVariantMap & )
22+
{
23+
return nullptr;
24+
}
25+
26+
void QgsAbstractHistoryProvider::updateNodeForEntry( QgsHistoryEntryNode *, const QVariantMap & )
27+
{
28+
29+
}

‎src/gui/history/qgshistoryprovider.h

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,20 @@ class GUI_EXPORT QgsAbstractHistoryProvider
5252
*/
5353
virtual QString id() const = 0;
5454

55-
#if 0
56-
5755
/**
5856
* Creates a new history node for the given \a entry.
57+
*
58+
* \since QGIS 3.32
5959
*/
60-
virtual QgsHistoryEntryNode *createNodeForEntry( const QVariantMap &entry ) = 0 SIP_FACTORY;
61-
#endif
60+
virtual QgsHistoryEntryNode *createNodeForEntry( const QVariantMap &entry ) SIP_FACTORY;
61+
62+
/**
63+
* Updates an existing history \a node for the given \a entry.
64+
*
65+
* \since QGIS 3.32
66+
*/
67+
virtual void updateNodeForEntry( QgsHistoryEntryNode *node, const QVariantMap &entry );
68+
6269
};
6370

6471
#endif //QGSHISTORYPROVIDER_H

0 commit comments

Comments
 (0)
Please sign in to comment.