QgsMetadataWidget class

A wizard to edit metadata on a map layer.

Public types

enum Mode { LayerMetadata = 0, ProjectMetadata }
Widget modes.

Public static functions

static auto parseLanguages() -> QMap<QString, QString>
Returns a list of languages available by default in the wizard.
static auto parseLicenses() -> QStringList
Returns a list of licences available by default in the wizard.
static auto parseLinkTypes() -> QStringList
Returns a list of link types available by default in the wizard.
static auto parseMimeTypes() -> QStringList
Returns a list of MIME types available by default in the wizard.
static auto parseTypes() -> QMap<QString, QString>
Returns a list of types available by default in the wizard.

Constructors, destructors, conversion operators

QgsMetadataWidget(QWidget* parent = nullptr, QgsMapLayer* layer = nullptr)
Constructor for the wizard.

Public functions

void acceptMetadata()
Saves the metadata to the layer.
auto checkMetadata() -> bool
Check if values in the wizard are correct.
void crsChanged()
If the CRS is updated.
auto metadata() -> QgsAbstractMetadataBase*
Returns a QgsAbstractMetadataBase object representing the current state of the widget.
auto mode() const -> Mode
Returns the widget's current mode.
void saveMetadata(QgsAbstractMetadataBase* metadata)
Save all fields in a metadata object.
void setMapCanvas(QgsMapCanvas* canvas)
Sets a map canvas associated with the widget.
void setMetadata(const QgsAbstractMetadataBase* metadata)
Sets the metadata to display in the widget.
void setMode(Mode mode)
Sets the widget's current mode.
auto title() const -> QString
Returns the current title field for the metadata.

Signals

void titleChanged(const QString& title)
Emitted when the title field is changed.

Public slots

void setTitle(const QString& title)
Sets the title field for the metadata.

Enum documentation

enum QgsMetadataWidget::Mode

Widget modes.

Enumerators
LayerMetadata

Show layer metadata.

ProjectMetadata

Show project metadata.

Function documentation

static QStringList QgsMetadataWidget::parseLinkTypes()

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

static QStringList QgsMetadataWidget::parseMimeTypes()

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

QgsMetadataWidget::QgsMetadataWidget(QWidget* parent = nullptr, QgsMapLayer* layer = nullptr)

Constructor for the wizard.

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

bool QgsMetadataWidget::checkMetadata()

Check if values in the wizard are correct.

QgsAbstractMetadataBase* QgsMetadataWidget::metadata()

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

Caller takes ownership of the returned object.

Mode QgsMetadataWidget::mode() const

Returns the widget's current mode.

void QgsMetadataWidget::saveMetadata(QgsAbstractMetadataBase* metadata)

Save all fields in a metadata object.

void QgsMetadataWidget::setMetadata(const QgsAbstractMetadataBase* metadata)

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.

void QgsMetadataWidget::setMode(Mode mode)

Sets the widget's current mode.

QString QgsMetadataWidget::title() const

Returns the current title field for the metadata.

void QgsMetadataWidget::titleChanged(const QString& title) signal

Emitted when the title field is changed.

void QgsMetadataWidget::setTitle(const QString& title) public slot

Sets the title field for the metadata.