Class: QgsVirtualLayerTask

Initializes a virtual layer with postpone mode activated and reloads the data in a separate 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

Abstract Methods

run

Reloads the data.

Methods

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.

setExceptionText

Sets the exceptionText

takeLayer

Returns the underlying virtual layer and ownership.

Virtual Methods

In PyQGIS, only methods marked as virtual can be safely overridden in a Python subclass of QgsVirtualLayerTask. See the FAQ for more details.

cancel

Cancels the pending query and the parent task.

class qgis.core.QgsVirtualLayerTask[source]

Bases: QgsTask

__init__(definition: QgsVirtualLayerDefinition)

Constructor.

Parameters:

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

virtual 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]

abstract 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]