Metatype QgsHistoryEntry

This commit is contained in:
Nyall Dawson 2023-04-19 08:54:53 +10:00
parent ae5808f4b2
commit d5cd4c99fc
4 changed files with 34 additions and 0 deletions

View File

@ -23,6 +23,11 @@ Encapsulates a history entry.
%End
public:
QgsHistoryEntry();
%Docstring
Constructor for an invalid entry.
%End
QgsHistoryEntry( const QString &providerId, const QDateTime &timestamp, const QVariantMap &entry );
%Docstring
Constructor for QgsHistoryEntry ``entry``, with the specified ``providerId`` and ``timestamp``.
@ -33,6 +38,13 @@ Constructor for QgsHistoryEntry ``entry``, with the specified ``providerId`` and
Constructor for QgsHistoryEntry ``entry``.
The entry timestamp will be automatically set to the current date/time.
%End
bool isValid() const;
%Docstring
Returns ``True`` if the entry is valid.
.. versionadded:: 3.32
%End
QDateTime timestamp;
@ -49,6 +61,7 @@ The entry timestamp will be automatically set to the current date/time.
};
class QgsHistoryProviderRegistry : QObject
{
%Docstring(signature="appended")

View File

@ -44,6 +44,11 @@ QgsHistoryEntry::QgsHistoryEntry( const QVariantMap &entry )
}
bool QgsHistoryEntry::isValid() const
{
return !providerId.isEmpty();
}
//
// QgsHistoryProviderRegistry
//

View File

@ -41,6 +41,11 @@ class GUI_EXPORT QgsHistoryEntry
{
public:
/**
* Constructor for an invalid entry.
*/
QgsHistoryEntry() = default;
/**
* Constructor for QgsHistoryEntry \a entry, with the specified \a providerId and \a timestamp.
*/
@ -53,6 +58,13 @@ class GUI_EXPORT QgsHistoryEntry
*/
QgsHistoryEntry( const QVariantMap &entry );
/**
* Returns TRUE if the entry is valid.
*
* \since QGIS 3.32
*/
bool isValid() const;
//! Entry timestamp
QDateTime timestamp;
@ -77,6 +89,8 @@ class GUI_EXPORT QgsHistoryEntry
};
Q_DECLARE_METATYPE( QgsHistoryEntry );
/**
* The QgsHistoryProviderRegistry is a registry for objects which track user history (i.e. operations performed through the GUI).
*

View File

@ -325,6 +325,8 @@ QgsGui::QgsGui()
mWidgetStateHelper = new QgsWidgetStateHelper();
mProcessingRecentAlgorithmLog = new QgsProcessingRecentAlgorithmLog();
mProcessingGuiRegistry = new QgsProcessingGuiRegistry();
qRegisterMetaType< QgsHistoryEntry >( "QgsHistoryEntry" );
}
bool QgsGui::pythonMacroAllowed( void ( *lambda )(), QgsMessageBar *messageBar )