QGIS API Documentation 3.40.0-Bratislava (b56115d8743)
Loading...
Searching...
No Matches
Classes | Signals | Public Member Functions | Static Public Member Functions | List of all members
QgsHistoryProviderRegistry Class Reference

The QgsHistoryProviderRegistry is a registry for objects which track user history (i.e. More...

#include <qgshistoryproviderregistry.h>

Inheritance diagram for QgsHistoryProviderRegistry:
Inheritance graph
[legend]

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.
 
QgsAbstractHistoryProviderproviderById (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< QgsHistoryEntryqueryEntries (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.
 

Detailed Description

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().

Since
QGIS 3.24

Definition at line 44 of file qgshistoryproviderregistry.h.

Constructor & Destructor Documentation

◆ QgsHistoryProviderRegistry()

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 31 of file qgshistoryproviderregistry.cpp.

◆ ~QgsHistoryProviderRegistry()

QgsHistoryProviderRegistry::~QgsHistoryProviderRegistry ( )
override

Definition at line 56 of file qgshistoryproviderregistry.cpp.

Member Function Documentation

◆ addDefaultProviders()

void QgsHistoryProviderRegistry::addDefaultProviders ( )

Adds the default history providers to the registry.

Note
Not available through Python bindings.

Definition at line 61 of file qgshistoryproviderregistry.cpp.

◆ addEntries()

bool QgsHistoryProviderRegistry::addEntries ( const QList< QgsHistoryEntry > &  entries,
QgsHistoryProviderRegistry::HistoryEntryOptions  options = QgsHistoryProviderRegistry::HistoryEntryOptions() 
)

Adds a list of entries to the history logs.

See also
addEntry()
entryAdded()

Definition at line 131 of file qgshistoryproviderregistry.cpp.

◆ addEntry() [1/2]

long long QgsHistoryProviderRegistry::addEntry ( const QgsHistoryEntry entry,
bool &  ok,
QgsHistoryProviderRegistry::HistoryEntryOptions  options = QgsHistoryProviderRegistry::HistoryEntryOptions() 
)

Adds an entry to the history logs.

Parameters
entryentry to add
okwill be set to true if entry was successfully added
optionsoptions
Returns
ID of newly added entry.
See also
entryAdded()

Definition at line 100 of file qgshistoryproviderregistry.cpp.

◆ addEntry() [2/2]

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.

Parameters
providerIdassociated QgsAbstractHistoryProvider::id()
entryentry to add
okwill be set to true if entry was successfully added
optionsoptions
Returns
ID of newly added entry.

Definition at line 95 of file qgshistoryproviderregistry.cpp.

◆ addProvider()

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 67 of file qgshistoryproviderregistry.cpp.

◆ clearHistory()

bool QgsHistoryProviderRegistry::clearHistory ( Qgis::HistoryProviderBackend  backend,
const QString &  providerId = QString() 
)

Clears the history for the specified backend.

See also
historyCleared()

Definition at line 275 of file qgshistoryproviderregistry.cpp.

◆ entry()

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.

Parameters
idID of entry to find
okwill be set to true if entry was found
backendassociated backend
Returns
matching entry if found

Definition at line 145 of file qgshistoryproviderregistry.cpp.

◆ entryAdded

void QgsHistoryProviderRegistry::entryAdded ( long long  id,
const QgsHistoryEntry entry,
Qgis::HistoryProviderBackend  backend 
)
signal

Emitted when an entry is added.

Since
QGIS 3.32

◆ entryUpdated

void QgsHistoryProviderRegistry::entryUpdated ( long long  id,
const QVariantMap &  entry,
Qgis::HistoryProviderBackend  backend 
)
signal

Emitted when an entry is updated.

Since
QGIS 3.32

◆ historyCleared

void QgsHistoryProviderRegistry::historyCleared ( Qgis::HistoryProviderBackend  backend,
const QString &  providerId 
)
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.

Since
QGIS 3.32

◆ providerById()

QgsAbstractHistoryProvider * QgsHistoryProviderRegistry::providerById ( const QString &  id)

Returns the provider with matching id, or nullptr if no matching provider is registered.

Definition at line 76 of file qgshistoryproviderregistry.cpp.

◆ providerIds()

QStringList QgsHistoryProviderRegistry::providerIds ( ) const

Returns a list of the registered provider IDs.

Definition at line 90 of file qgshistoryproviderregistry.cpp.

◆ queryEntries()

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 215 of file qgshistoryproviderregistry.cpp.

◆ removeProvider()

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 81 of file qgshistoryproviderregistry.cpp.

◆ updateEntry()

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 189 of file qgshistoryproviderregistry.cpp.

◆ userHistoryDbPath()

QString QgsHistoryProviderRegistry::userHistoryDbPath ( )
static

Returns the path to user's local history database.

Definition at line 270 of file qgshistoryproviderregistry.cpp.


The documentation for this class was generated from the following files: