Class: QgsMapLayerConfigWidgetFactory

class qgis.gui.QgsMapLayerConfigWidgetFactory

Bases: sip.wrapper

Factory class for creating custom map layer property pages

New in version 2.16.

QgsMapLayerConfigWidgetFactory() Constructor

QgsMapLayerConfigWidgetFactory(title: str, icon: QIcon) Constructor

QgsMapLayerConfigWidgetFactory(QgsMapLayerConfigWidgetFactory)

Enums

ParentPage

Bases: enum.IntEnum

Methods

createWidget

Factory function to create the widget on demand as needed by the dock.

icon

The icon that will be shown in the UI for the panel.

layerPropertiesPagePositionHint

Returns a tab name hinting at where this page should be inserted into the layer properties tab list.

parentPage

Returns the associated parent page, for factories which create sub-components of a standard page.

setIcon

Set the icon for the factory object.

setSupportLayerPropertiesDialog

Set support flag for style dock

setSupportsStyleDock

Set support flag for style dock

setTitle

Set the title for the interface

supportLayerPropertiesDialog

Flag if widget is supported for use in layer properties dialog.

supportsLayer

Check if the layer is supported for this widget.

supportsLayerTreeGroup

Check if a layer tree group is supported for this widget.

supportsStyleDock

Flag if widget is supported for use in style dock.

title

The title of the panel.

class ParentPage(value)

Bases: enum.IntEnum

Available parent pages, for factories which create a widget which is a sub-component of a standard page.

New in version 3.20.

  • NoParent: Factory creates pages itself, not sub-components

  • Temporal: Factory creates sub-components of the temporal properties page (only supported for raster layer temporal properties)

NoParent = 0
Temporal = 1
createWidget(self, layer: QgsMapLayer, canvas: QgsMapCanvas, dockWidget: bool = True, parent: QWidget = None) QgsMapLayerConfigWidget

Factory function to create the widget on demand as needed by the dock.

Parameters:
  • layer (QgsMapLayer) – The active layer in the dock.

  • canvas (QgsMapCanvas) – The map canvas.

  • dockWidget (bool = True) – True of the widget will be shown a dock style widget.

  • parent (QWidget = None) – The parent of the widget.

Return type:

QgsMapLayerConfigWidget

Returns:

A new QgsMapStylePanel which is shown in the map style dock.

Note

This function is called each time the panel is selected. Keep it light for better UX.

icon(self) QIcon

The icon that will be shown in the UI for the panel.

Return type:

QIcon

Returns:

A QIcon for the panel icon.

layerPropertiesPagePositionHint(self) str

Returns a tab name hinting at where this page should be inserted into the layer properties tab list.

If the returned string is non-empty, the config widget page will be inserted before the existing page with matching object name.

The default implementation returns an empty string, which causes the widget to be placed at the end of the dialog page list.

New in version 3.14.

Return type:

str

parentPage(self) QgsMapLayerConfigWidgetFactory.ParentPage

Returns the associated parent page, for factories which create sub-components of a standard page.

The default implementation returns QgsMapLayerConfigWidgetFactory.ParentPage.NoParent, indicating that the factory creates top-level pages which are not subcomponents.

New in version 3.20.

Return type:

QgsMapLayerConfigWidgetFactory.ParentPage

setIcon(self, icon: QIcon)

Set the icon for the factory object.

Parameters:

icon (QIcon) – The icon to show in the interface.

setSupportLayerPropertiesDialog(self, supports: bool)

Set support flag for style dock

Parameters:

supports (bool) – True if this widget is supported in the style dock.

setSupportsStyleDock(self, supports: bool)

Set support flag for style dock

Parameters:

supports (bool) – True if this widget is supported in the style dock.

setTitle(self, title: str)

Set the title for the interface

Note

Not all users may show this as a label e.g style dock uses this as a tooltip.

Parameters:

title (str) – The title to set.

supportLayerPropertiesDialog(self) bool

Flag if widget is supported for use in layer properties dialog. The default implementation returns False.

Return type:

bool

Returns:

True if supported

supportsLayer(self, layer: QgsMapLayer) bool

Check if the layer is supported for this widget.

Return type:

bool

Returns:

True if this layer is supported for this widget

Parameters:

layer (QgsMapLayer) –

supportsLayerTreeGroup(self, group: QgsLayerTreeGroup) bool

Check if a layer tree group is supported for this widget.

Return type:

bool

Returns:

True if the group is supported for this widget

New in version 3.24.

Parameters:

group (QgsLayerTreeGroup) –

supportsStyleDock(self) bool

Flag if widget is supported for use in style dock. The default implementation returns False.

Return type:

bool

Returns:

True if supported

title(self) str

The title of the panel.

Return type:

str

Returns:

Title of the panel

Note

This may or may not be shown to the user.