Class: QgsVirtualLayerTask

Initializes a virtual layer with postpone mode activated and reloads the data in a separated thread.

Added in version 3.2.

Class Hierarchy

Inheritance diagram of qgis.core.QgsVirtualLayerTask

Base classes

QgsTask

Abstract base class for long running background tasks.

QObject

Methods

cancel

Cancels the pending query and the parent task.

definition

Returns the virtual layer definition.

exceptionText

Returns the exception text or an empty string if no exceptions were raised

layer

Returns the underlying virtual layer.

run

Reloads the data.

setExceptionText

Sets the exceptionText

takeLayer

Returns the underlying virtual layer and ownership.

class qgis.core.QgsVirtualLayerTask[source]

Bases: QgsTask

__init__(definition: QgsVirtualLayerDefinition)

Constructor.

Parameters:

definition (QgsVirtualLayerDefinition) – The definition to use for initializing the virtual layer

cancel(self)[source]

Cancels the pending query and the parent task.

definition(self) QgsVirtualLayerDefinition[source]

Returns the virtual layer definition.

Return type:

QgsVirtualLayerDefinition

exceptionText(self) str[source]

Returns the exception text or an empty string if no exceptions were raised

Added in version 3.4.

Return type:

str

layer(self) QgsVectorLayer | None[source]

Returns the underlying virtual layer.

Return type:

Optional[QgsVectorLayer]

run(self) bool[source]

Reloads the data.

Return type:

bool

Returns:

True if the virtual layer is valid, False otherwise.

setExceptionText(self, exceptionText: str | None)[source]

Sets the exceptionText

Added in version 3.4.

Parameters:

exceptionText (Optional[str])

takeLayer(self) QgsVectorLayer | None[source]

Returns the underlying virtual layer and ownership.

Return type:

Optional[QgsVectorLayer]