Class: QgsLayerPropertiesDialog

Base class for “layer properties” dialogs, containing common utilities for handling functionality in these dialogs.

Warning

This is exposed to SIP bindings for legacy reasons only, and is NOT to be considered as stable API.

Added in version 3.34.

Class Hierarchy

Inheritance diagram of qgis.gui.QgsLayerPropertiesDialog

Base classes

QgsOptionsDialogBase

A base dialog for options and properties dialogs that offers vertical tabs.

QDialog

QWidget

QObject

QPaintDevice

Subclasses

QgsMeshLayerProperties

A dialog for configuring mesh layer properties.

QgsRasterLayerProperties

A dialog for raster layer properties.

QgsVectorLayerProperties

Layer properties dialog for vector layers.

QgsVectorTileLayerProperties

Layer properties dialog for vector tile layers.

Methods

loadDefaultMetadata

Reloads the default layer metadata for the layer.

loadDefaultStyle

Reloads the default style for the layer.

loadMetadataFromFile

Allows the user to load layer metadata from a file.

loadStyle

Triggers a dialog to load a saved style

loadStyleFromFile

Allows the user to load layer style from a file.

saveDefaultStyle

Saves the default style when appropriate button is pressed

saveMetadataAsDefault

Saves the current layer metadata as the default for the layer.

saveMetadataToFile

Allows the user to save the layer's metadata as a file.

saveStyleAs

Saves a style when appriate button is pressed

saveStyleAsDefault

Saves the current layer style as the default for the layer.

saveStyleToFile

Allows the user to save the layer's style to a file.

setMetadataWidget

Sets the metadata widget and page associated with the dialog.

Virtual Methods

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

addPropertiesPageFactory

Adds properties page from a factory.

class qgis.gui.QgsLayerPropertiesDialog[source]

Bases: QgsOptionsDialogBase

__init__(layer: QgsMapLayer | None, canvas: QgsMapCanvas | None, settingsKey: str | None, parent: QWidget | None = None, fl: Qt.WindowFlags | Qt.WindowType = Qt.WindowFlags(), settings: QgsSettings | None = None)

Constructor for QgsLayerPropertiesDialog.

Parameters:
  • layer (Optional[QgsMapLayer]) – associated map layer

  • canvas (Optional[QgsMapCanvas]) – associated map canvas

  • settingsKey (Optional[str]) – QgsSettings subgroup key for saving/restore ui states, e.g. “VectorLayerProperties”.

  • parent (Optional[QWidget] = None) – parent object (owner)

  • fl (Union[Qt.WindowFlags, Qt.WindowType] = Qt.WindowFlags()) – widget flags

  • settings (Optional[QgsSettings] = None) – custom QgsSettings pointer

virtual addPropertiesPageFactory(self, factory: QgsMapLayerConfigWidgetFactory | None)[source]

Adds properties page from a factory.

Parameters:

factory (Optional[QgsMapLayerConfigWidgetFactory])

loadDefaultMetadata(self)[source]

Reloads the default layer metadata for the layer.

loadDefaultStyle(self)[source]

Reloads the default style for the layer.

loadMetadataFromFile(self)[source]

Allows the user to load layer metadata from a file.

loadStyle(self)[source]

Triggers a dialog to load a saved style

Added in version 3.30.

loadStyleFromFile(self)[source]

Allows the user to load layer style from a file.

saveDefaultStyle(self)[source]

Saves the default style when appropriate button is pressed

Added in version 3.30.

saveMetadataAsDefault(self)[source]

Saves the current layer metadata as the default for the layer.

loadDefaultMetadata()

saveMetadataToFile(self)[source]

Allows the user to save the layer’s metadata as a file.

saveStyleAs(self)[source]

Saves a style when appriate button is pressed

Added in version 3.30.

saveStyleAsDefault(self)[source]

Saves the current layer style as the default for the layer.

loadDefaultStyle()

saveStyleToFile(self)[source]

Allows the user to save the layer’s style to a file.

setMetadataWidget(self, widget: QgsMetadataWidget | None, page: QWidget | None)[source]

Sets the metadata widget and page associated with the dialog.

This must be called in order for the standard metadata loading/saving functionality to be available.

Parameters: