QGIS API Documentation 3.41.0-Master (45a0abf3bec)
|
The QgsHistoryProviderRegistry is a registry for objects which track user history (i.e. More...
#include <qgshistoryproviderregistry.h>
Classes | |
class | HistoryEntryOptions |
Contains options for storing history entries. More... | |
Signals | |
void | entryAdded (long long id, const QgsHistoryEntry &entry, Qgis::HistoryProviderBackend backend) |
Emitted when an entry is added. | |
void | entryUpdated (long long id, const QVariantMap &entry, Qgis::HistoryProviderBackend backend) |
Emitted when an entry is updated. | |
void | historyCleared (Qgis::HistoryProviderBackend backend, const QString &providerId) |
Emitted when the history is cleared for a backend. | |
Public Member Functions | |
QgsHistoryProviderRegistry (QObject *parent=nullptr, bool useMemoryDatabase=false) | |
Creates a new empty history provider registry. | |
~QgsHistoryProviderRegistry () override | |
void | addDefaultProviders () |
Adds the default history providers to the registry. | |
bool | addEntries (const QList< QgsHistoryEntry > &entries, QgsHistoryProviderRegistry::HistoryEntryOptions options=QgsHistoryProviderRegistry::HistoryEntryOptions()) |
Adds a list of entries to the history logs. | |
long long | addEntry (const QgsHistoryEntry &entry, bool &ok, QgsHistoryProviderRegistry::HistoryEntryOptions options=QgsHistoryProviderRegistry::HistoryEntryOptions()) |
Adds an entry to the history logs. | |
long long | addEntry (const QString &providerId, const QVariantMap &entry, bool &ok, QgsHistoryProviderRegistry::HistoryEntryOptions options=QgsHistoryProviderRegistry::HistoryEntryOptions()) |
Adds an entry to the history logs. | |
bool | addProvider (QgsAbstractHistoryProvider *provider) |
Adds a provider to the registry. | |
bool | clearHistory (Qgis::HistoryProviderBackend backend, const QString &providerId=QString()) |
Clears the history for the specified backend. | |
QgsHistoryEntry | entry (long long id, bool &ok, Qgis::HistoryProviderBackend backend=Qgis::HistoryProviderBackend::LocalProfile) const |
Returns the entry with matching ID, from the specified backend. | |
QgsAbstractHistoryProvider * | providerById (const QString &id) |
Returns the provider with matching id, or nullptr if no matching provider is registered. | |
QStringList | providerIds () const |
Returns a list of the registered provider IDs. | |
QList< QgsHistoryEntry > | queryEntries (const QDateTime &start=QDateTime(), const QDateTime &end=QDateTime(), const QString &providerId=QString(), Qgis::HistoryProviderBackends backends=Qgis::HistoryProviderBackend::LocalProfile) const |
Queries history entries which occurred between the specified start and end times. | |
bool | removeProvider (const QString &id) |
Removes the provider with matching id. | |
bool | updateEntry (long long id, const QVariantMap &entry, Qgis::HistoryProviderBackend backend=Qgis::HistoryProviderBackend::LocalProfile) |
Updates the existing entry with matching id. | |
Static Public Member Functions | |
static QString | userHistoryDbPath () |
Returns the path to user's local history database. | |
The QgsHistoryProviderRegistry is a registry for objects which track user history (i.e.
operations performed through the GUI).
QgsHistoryProviderRegistry is not usually directly created, but rather accessed through QgsGui::historyProviderRegistry().
Definition at line 44 of file qgshistoryproviderregistry.h.
QgsHistoryProviderRegistry::QgsHistoryProviderRegistry | ( | QObject * | parent = nullptr , |
bool | useMemoryDatabase = false |
||
) |
Creates a new empty history provider registry.
QgsHistoryProviderRegistry is not usually directly created, but rather accessed through QgsGui::historyProviderRegistry().
Definition at line 32 of file qgshistoryproviderregistry.cpp.
|
override |
Definition at line 57 of file qgshistoryproviderregistry.cpp.
void QgsHistoryProviderRegistry::addDefaultProviders | ( | ) |
Adds the default history providers to the registry.
Definition at line 62 of file qgshistoryproviderregistry.cpp.
bool QgsHistoryProviderRegistry::addEntries | ( | const QList< QgsHistoryEntry > & | entries, |
QgsHistoryProviderRegistry::HistoryEntryOptions | options = QgsHistoryProviderRegistry::HistoryEntryOptions() |
||
) |
Adds a list of entries to the history logs.
Definition at line 132 of file qgshistoryproviderregistry.cpp.
long long QgsHistoryProviderRegistry::addEntry | ( | const QgsHistoryEntry & | entry, |
bool & | ok, | ||
QgsHistoryProviderRegistry::HistoryEntryOptions | options = QgsHistoryProviderRegistry::HistoryEntryOptions() |
||
) |
Adds an entry to the history logs.
entry | entry to add |
ok | will be set to true if entry was successfully added |
options | options |
Definition at line 101 of file qgshistoryproviderregistry.cpp.
long long QgsHistoryProviderRegistry::addEntry | ( | const QString & | providerId, |
const QVariantMap & | entry, | ||
bool & | ok, | ||
QgsHistoryProviderRegistry::HistoryEntryOptions | options = QgsHistoryProviderRegistry::HistoryEntryOptions() |
||
) |
Adds an entry to the history logs.
The entry will be tagged with the current date/time as the timestamp.
The providerId specifies the history provider responsible for this entry. Entry options are specified via the options argument.
providerId | associated QgsAbstractHistoryProvider::id() |
entry | entry to add |
ok | will be set to true if entry was successfully added |
options | options |
Definition at line 96 of file qgshistoryproviderregistry.cpp.
bool QgsHistoryProviderRegistry::addProvider | ( | QgsAbstractHistoryProvider * | provider | ) |
Adds a provider to the registry.
Ownership of the provider is transferred to the registry.
Returns true
if the provider was successfully added.
Definition at line 68 of file qgshistoryproviderregistry.cpp.
bool QgsHistoryProviderRegistry::clearHistory | ( | Qgis::HistoryProviderBackend | backend, |
const QString & | providerId = QString() |
||
) |
Clears the history for the specified backend.
Definition at line 276 of file qgshistoryproviderregistry.cpp.
QgsHistoryEntry QgsHistoryProviderRegistry::entry | ( | long long | id, |
bool & | ok, | ||
Qgis::HistoryProviderBackend | backend = Qgis::HistoryProviderBackend::LocalProfile |
||
) | const |
Returns the entry with matching ID, from the specified backend.
id | ID of entry to find |
ok | will be set to true if entry was found |
backend | associated backend |
Definition at line 146 of file qgshistoryproviderregistry.cpp.
|
signal |
Emitted when an entry is added.
|
signal |
Emitted when an entry is updated.
|
signal |
Emitted when the history is cleared for a backend.
If providerId is non-empty then the history has only been cleared for the specified provider.
QgsAbstractHistoryProvider * QgsHistoryProviderRegistry::providerById | ( | const QString & | id | ) |
Returns the provider with matching id, or nullptr
if no matching provider is registered.
Definition at line 77 of file qgshistoryproviderregistry.cpp.
QStringList QgsHistoryProviderRegistry::providerIds | ( | ) | const |
Returns a list of the registered provider IDs.
Definition at line 91 of file qgshistoryproviderregistry.cpp.
QList< QgsHistoryEntry > QgsHistoryProviderRegistry::queryEntries | ( | const QDateTime & | start = QDateTime() , |
const QDateTime & | end = QDateTime() , |
||
const QString & | providerId = QString() , |
||
Qgis::HistoryProviderBackends | backends = Qgis::HistoryProviderBackend::LocalProfile |
||
) | const |
Queries history entries which occurred between the specified start and end times.
The optional providerId and backends arguments can be used to filter entries.
Definition at line 216 of file qgshistoryproviderregistry.cpp.
bool QgsHistoryProviderRegistry::removeProvider | ( | const QString & | id | ) |
Removes the provider with matching id.
The provider will be deleted.
Returns true
if the provider was successfully removed.
Definition at line 82 of file qgshistoryproviderregistry.cpp.
bool QgsHistoryProviderRegistry::updateEntry | ( | long long | id, |
const QVariantMap & | entry, | ||
Qgis::HistoryProviderBackend | backend = Qgis::HistoryProviderBackend::LocalProfile |
||
) |
Updates the existing entry with matching id.
This method allows the content of an entry to be updated, e.g. to add additional properties to the content. (Such as recording the results of after a long-running operation completes).
Definition at line 190 of file qgshistoryproviderregistry.cpp.
|
static |
Returns the path to user's local history database.
Definition at line 271 of file qgshistoryproviderregistry.cpp.