Class: QgsMetadataWidget

A wizard to edit metadata on a map layer.

Class Hierarchy

Inheritance diagram of qgis.gui.QgsMetadataWidget

Base classes

QWidget

QObject

QPaintDevice

class qgis.gui.QgsMetadataWidget[source]

Bases: QWidget

__init__(parent: QWidget | None = None, layer: QgsMapLayer | None = None)

Constructor for the wizard.

If layer is set, then this constructor automatically sets the widget’s metadata() to match the layer’s metadata..

See also

setMetadata()

Parameters:
  • parent (Optional[QWidget] = None)

  • layer (Optional[QgsMapLayer] = None)

LayerMetadata = 0
class Mode

Bases: int

ProjectMetadata = 1
acceptMetadata(self)[source]

Saves the metadata to the layer.

checkMetadata(self) bool[source]

Check if values in the wizard are correct.

See also

saveMetadata()

Return type:

bool

crsChanged(self)[source]

If the CRS is updated.

metadata(self) QgsAbstractMetadataBase | None[source]

Returns a QgsAbstractMetadataBase object representing the current state of the widget.

Caller takes ownership of the returned object.

See also

saveMetadata()

Return type:

Optional[QgsAbstractMetadataBase]

mode(self) QgsMetadataWidget.Mode[source]

Returns the widget’s current mode.

See also

setMode()

Added in version 3.2.

Return type:

QgsMetadataWidget.Mode

static parseLanguages() Dict[str, str]

Returns a list of languages available by default in the wizard.

Return type:

Dict[str, str]

static parseLicenses() List[str][source]

Returns a list of licences available by default in the wizard.

Return type:

List[str]

static parseLinkTypes() List[str][source]

Returns a list of link types available by default in the wizard.

Return type:

List[str]

static parseMimeTypes() List[str][source]

Returns a list of MIME types available by default in the wizard.

Return type:

List[str]

static parseTypes() Dict[str, str]

Returns a list of types available by default in the wizard.

Return type:

Dict[str, str]

saveMetadata(self, metadata: QgsAbstractMetadataBase | None)[source]

Save all fields in a metadata object.

See also

metadata()

See also

acceptMetadata()

See also

checkMetadata()

Parameters:

metadata (Optional[QgsAbstractMetadataBase])

setMapCanvas(self, canvas: QgsMapCanvas | None)[source]

Sets a map canvas associated with the widget.

Parameters:

canvas (Optional[QgsMapCanvas])

setMetadata(self, metadata: QgsAbstractMetadataBase | None)[source]

Sets the metadata to display in the widget.

This method can be called after constructing a QgsMetadataWidget in order to set the displayed metadata to custom, non-layer based metadata.

Calling this method will automatically setMode() to the correct mode corresponding to the specified metadata object.

See also

metadata()

Parameters:

metadata (Optional[QgsAbstractMetadataBase])

setMode(self, mode: QgsMetadataWidget.Mode)[source]

Sets the widget’s current mode.

See also

mode()

Added in version 3.2.

Parameters:

mode (QgsMetadataWidget.Mode)

setTitle(self, title: str | None)[source]

Sets the title field for the metadata.

See also

title()

See also

titleChanged()

Added in version 3.2.

Parameters:

title (Optional[str])

title(self) str[source]

Returns the current title field for the metadata.

See also

setTitle()

See also

titleChanged()

Added in version 3.2.

Return type:

str

signal titleChanged[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.