Class: QgsHistoryProviderRegistry¶
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().
Added in version 3.24.
Class Hierarchy¶
Base classes¶
- class qgis.gui.QgsHistoryProviderRegistry[source]¶
Bases:
QObject- __init__(parent: QObject | None = None, useMemoryDatabase: bool = False)
Creates a new empty history provider registry.
QgsHistoryProviderRegistry is not usually directly created, but rather accessed through
QgsGui.historyProviderRegistry().- Parameters:
parent (Optional[QObject] = None)
useMemoryDatabase (bool = False)
- class HistoryEntryOptions[source]¶
Bases:
objectContains options for storing history entries.
Added in version 3.24.
QgsHistoryProviderRegistry.HistoryEntryOptions() Constructor for HistoryEntryOptions.
QgsHistoryProviderRegistry.HistoryEntryOptions(a0: QgsHistoryProviderRegistry.HistoryEntryOptions)
- storageBackends: Qgis.HistoryProviderBackends¶
- addEntries(self, entries: Iterable[QgsHistoryEntry], options: QgsHistoryProviderRegistry.HistoryEntryOptions = QgsHistoryProviderRegistry.HistoryEntryOptions()) bool[source]¶
Adds a list of
entriesto the history logs.See also
See also
- Parameters:
entries (Iterable[QgsHistoryEntry])
options (QgsHistoryProviderRegistry.HistoryEntryOptions = QgsHistoryProviderRegistry.HistoryEntryOptions())
- Return type:
bool
- addEntry(self, providerId: str | None, entry: Dict[str, Any], options: QgsHistoryProviderRegistry.HistoryEntryOptions = QgsHistoryProviderRegistry.HistoryEntryOptions())¶
Adds an
entryto the history logs.The entry will be tagged with the current date/time as the timestamp.
The
providerIdspecifies the history provider responsible for this entry. Entry options are specified via theoptionsargument.- Parameters:
providerId (Optional[str]) – associated
QgsAbstractHistoryProvider.id()entry (Dict[str, Any]) – entry to add
options (QgsHistoryProviderRegistry.HistoryEntryOptions = QgsHistoryProviderRegistry.HistoryEntryOptions()) -> (int) – options
- Returns:
ID of newly added entry.
ok:
Trueif entry was successfully added
addEntry(self, entry:
QgsHistoryEntry, options: QgsHistoryProviderRegistry.HistoryEntryOptions = QgsHistoryProviderRegistry.HistoryEntryOptions()) -> (int, bool) Adds anentryto the history logs.- Parameters:
entry – entry to add
options – options
- Returns:
ID of newly added entry.
ok:
Trueif entry was successfully added
See also
- addProvider(self, provider: QgsAbstractHistoryProvider | None) bool[source]¶
Adds a
providerto the registry. Ownership of the provider is transferred to the registry.Returns
Trueif the provider was successfully added.- Parameters:
provider (Optional[QgsAbstractHistoryProvider])
- Return type:
bool
- clearHistory(self, backend: Qgis.HistoryProviderBackend, providerId: str | None = '') bool[source]¶
Clears the history for the specified
backend.See also
- Parameters:
backend (Qgis.HistoryProviderBackend)
providerId (Optional[str] = '')
- Return type:
bool
- entry(self, id: int, backend: Qgis.HistoryProviderBackend = Qgis.HistoryProviderBackend.LocalProfile)[source]¶
Returns the entry with matching ID, from the specified
backend.- Parameters:
id (int) – ID of entry to find
ok – will be set to
Trueif entry was foundbackend (Qgis.HistoryProviderBackend = Qgis.HistoryProviderBackend.LocalProfile) -> (QgsHistoryEntry) – associated backend
- Returns:
matching entry if found
- signal entryAdded[source]¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- signal entryUpdated[source]¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- signal historyCleared[source]¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- providerById(self, id: str | None) QgsAbstractHistoryProvider | None[source]¶
Returns the provider with matching
id, orNoneif no matching provider is registered.- Parameters:
id (Optional[str])
- Return type:
Optional[QgsAbstractHistoryProvider]
- providerIds(self) List[str][source]¶
Returns a list of the registered provider IDs.
- Return type:
List[str]
- queryEntries(self, start: QDateTime | datetime.datetime = QDateTime(), end: QDateTime | datetime.datetime = QDateTime(), providerId: str | None = '', backends: Qgis.HistoryProviderBackends | Qgis.HistoryProviderBackend = Qgis.HistoryProviderBackend.LocalProfile) List[QgsHistoryEntry]¶
Queries history entries which occurred between the specified
startandendtimes.The optional
providerIdandbackendsarguments can be used to filter entries.- Parameters:
start (Union[QDateTime, datetime.datetime] = QDateTime())
end (Union[QDateTime, datetime.datetime] = QDateTime())
providerId (Optional[str] = '')
backends (Union[Qgis.HistoryProviderBackends, Qgis.HistoryProviderBackend] = Qgis.HistoryProviderBackend.LocalProfile)
- Return type:
- removeProvider(self, id: str | None) bool[source]¶
Removes the provider with matching
id.The provider will be deleted.
Returns
Trueif the provider was successfully removed.- Parameters:
id (Optional[str])
- Return type:
bool
- updateEntry(self, id: int, entry: Dict[str, Any], backend: Qgis.HistoryProviderBackend = Qgis.HistoryProviderBackend.LocalProfile) bool[source]¶
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).
- Parameters:
id (int)
entry (Dict[str, Any])
backend (Qgis.HistoryProviderBackend = Qgis.HistoryProviderBackend.LocalProfile)
- Return type:
bool