Class: QgsLightSource

Base class for light sources in 3d scenes.

Added in version 3.26.

Note

This is an abstract class, with methods which must be implemented by a subclass.

The following methods must be implemented: clone(), readXml(), type(), writeXml()

Class Hierarchy

Inheritance diagram of qgis._3d.QgsLightSource

Subclasses

QgsDirectionalLightSettings

Definition of a directional light in a 3D map scene.

QgsPointLightSettings

Definition of a point light in a 3D map scene.

Abstract Methods

clone

Returns a copy of the light source.

readXml

Reads configuration from a DOM element previously written using writeXml().

type

Returns the light source type.

writeXml

Writes the light source's configuration to a new DOM element and returns it.

Virtual Methods

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

resolveReferences

After reading from XML, resolve references to any layers that have been read as layer IDs.

Static Methods

createFromXml

Creates a new light source from an XML element.

class qgis._3d.QgsLightSource[source]

Bases: object

abstract clone(self) QgsLightSource | None[source]

Returns a copy of the light source.

Return type:

Optional[QgsLightSource]

static createFromXml(element: QDomElement, context: QgsReadWriteContext) QgsLightSource | None[source]

Creates a new light source from an XML element.

Parameters:
Return type:

Optional[QgsLightSource]

abstract readXml(self, elem: QDomElement, context: QgsReadWriteContext = QgsReadWriteContext())[source]

Reads configuration from a DOM element previously written using writeXml().

See also

writeXml()

Parameters:
virtual resolveReferences(self, project: QgsProject)[source]

After reading from XML, resolve references to any layers that have been read as layer IDs.

Parameters:

project (QgsProject)

abstract type(self) Qgis.LightSourceType[source]

Returns the light source type.

Return type:

Qgis.LightSourceType

abstract writeXml(self, doc: QDomDocument, context: QgsReadWriteContext = QgsReadWriteContext()) QDomElement[source]

Writes the light source’s configuration to a new DOM element and returns it.

See also

readXml()

Parameters:
Return type:

QDomElement