Skip to content

Commit

Permalink
Add capacity for history providers to create/update nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Apr 22, 2023
1 parent dd25f39 commit 0774c80
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 4 deletions.
14 changes: 14 additions & 0 deletions python/gui/auto_generated/history/qgshistoryprovider.sip.in
Expand Up @@ -36,6 +36,20 @@ Abstract base class for objects which track user history (i.e. operations perfor
virtual QString id() const = 0;
%Docstring
Returns the provider's unique id, which is used to associate existing history entries with the provider.
%End

virtual QgsHistoryEntryNode *createNodeForEntry( const QVariantMap &entry ) /Factory/;
%Docstring
Creates a new history node for the given ``entry``.

.. versionadded:: 3.32
%End

virtual void updateNodeForEntry( QgsHistoryEntryNode *node, const QVariantMap &entry );
%Docstring
Updates an existing history ``node`` for the given ``entry``.

.. versionadded:: 3.32
%End

};
Expand Down
10 changes: 10 additions & 0 deletions src/gui/history/qgshistoryprovider.cpp
Expand Up @@ -17,3 +17,13 @@
#include "qgshistoryprovider.h"

QgsAbstractHistoryProvider::~QgsAbstractHistoryProvider() = default;

QgsHistoryEntryNode *QgsAbstractHistoryProvider::createNodeForEntry( const QVariantMap & )
{
return nullptr;
}

void QgsAbstractHistoryProvider::updateNodeForEntry( QgsHistoryEntryNode *, const QVariantMap & )
{

}
15 changes: 11 additions & 4 deletions src/gui/history/qgshistoryprovider.h
Expand Up @@ -52,13 +52,20 @@ class GUI_EXPORT QgsAbstractHistoryProvider
*/
virtual QString id() const = 0;

#if 0

/**
* Creates a new history node for the given \a entry.
*
* \since QGIS 3.32
*/
virtual QgsHistoryEntryNode *createNodeForEntry( const QVariantMap &entry ) = 0 SIP_FACTORY;
#endif
virtual QgsHistoryEntryNode *createNodeForEntry( const QVariantMap &entry ) SIP_FACTORY;

/**
* Updates an existing history \a node for the given \a entry.
*
* \since QGIS 3.32
*/
virtual void updateNodeForEntry( QgsHistoryEntryNode *node, const QVariantMap &entry );

};

#endif //QGSHISTORYPROVIDER_H
Expand Down

0 comments on commit 0774c80

Please sign in to comment.