Skip to content

Commit d5cd4c9

Browse files
committedApr 22, 2023
Metatype QgsHistoryEntry
1 parent ae5808f commit d5cd4c9

File tree

4 files changed

+34
-0
lines changed

4 files changed

+34
-0
lines changed
 

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ Encapsulates a history entry.
2323
%End
2424
public:
2525

26+
QgsHistoryEntry();
27+
%Docstring
28+
Constructor for an invalid entry.
29+
%End
30+
2631
QgsHistoryEntry( const QString &providerId, const QDateTime &timestamp, const QVariantMap &entry );
2732
%Docstring
2833
Constructor for QgsHistoryEntry ``entry``, with the specified ``providerId`` and ``timestamp``.
@@ -33,6 +38,13 @@ Constructor for QgsHistoryEntry ``entry``, with the specified ``providerId`` and
3338
Constructor for QgsHistoryEntry ``entry``.
3439

3540
The entry timestamp will be automatically set to the current date/time.
41+
%End
42+
43+
bool isValid() const;
44+
%Docstring
45+
Returns ``True`` if the entry is valid.
46+
47+
.. versionadded:: 3.32
3648
%End
3749

3850
QDateTime timestamp;
@@ -49,6 +61,7 @@ The entry timestamp will be automatically set to the current date/time.
4961

5062
};
5163

64+
5265
class QgsHistoryProviderRegistry : QObject
5366
{
5467
%Docstring(signature="appended")

‎src/gui/history/qgshistoryproviderregistry.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ QgsHistoryEntry::QgsHistoryEntry( const QVariantMap &entry )
4444

4545
}
4646

47+
bool QgsHistoryEntry::isValid() const
48+
{
49+
return !providerId.isEmpty();
50+
}
51+
4752
//
4853
// QgsHistoryProviderRegistry
4954
//

‎src/gui/history/qgshistoryproviderregistry.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ class GUI_EXPORT QgsHistoryEntry
4141
{
4242
public:
4343

44+
/**
45+
* Constructor for an invalid entry.
46+
*/
47+
QgsHistoryEntry() = default;
48+
4449
/**
4550
* Constructor for QgsHistoryEntry \a entry, with the specified \a providerId and \a timestamp.
4651
*/
@@ -53,6 +58,13 @@ class GUI_EXPORT QgsHistoryEntry
5358
*/
5459
QgsHistoryEntry( const QVariantMap &entry );
5560

61+
/**
62+
* Returns TRUE if the entry is valid.
63+
*
64+
* \since QGIS 3.32
65+
*/
66+
bool isValid() const;
67+
5668
//! Entry timestamp
5769
QDateTime timestamp;
5870

@@ -77,6 +89,8 @@ class GUI_EXPORT QgsHistoryEntry
7789

7890
};
7991

92+
Q_DECLARE_METATYPE( QgsHistoryEntry );
93+
8094
/**
8195
* The QgsHistoryProviderRegistry is a registry for objects which track user history (i.e. operations performed through the GUI).
8296
*

‎src/gui/qgsgui.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,8 @@ QgsGui::QgsGui()
325325
mWidgetStateHelper = new QgsWidgetStateHelper();
326326
mProcessingRecentAlgorithmLog = new QgsProcessingRecentAlgorithmLog();
327327
mProcessingGuiRegistry = new QgsProcessingGuiRegistry();
328+
329+
qRegisterMetaType< QgsHistoryEntry >( "QgsHistoryEntry" );
328330
}
329331

330332
bool QgsGui::pythonMacroAllowed( void ( *lambda )(), QgsMessageBar *messageBar )

0 commit comments

Comments
 (0)
Please sign in to comment.