Class: QgsMapLayerConfigWidgetFactory¶
Factory class for creating custom map layer property pages.
Note
This is an abstract class, with methods which must be implemented by a subclass.
The following methods must be implemented: createWidget()
Enums
Available parent pages, for factories which create a widget which is a sub-component of a standard page. |
Abstract Methods
Factory function to create the widget on demand as needed by the dock. |
Methods
Set the icon for the factory object. |
|
Set support flag for style dock |
|
Set support flag for style dock |
|
Set the title for the interface |
Virtual Methods
In PyQGIS, only methods marked as virtual
can be safely overridden in a Python subclass of QgsMapLayerConfigWidgetFactory. See the FAQ for more details.
The icon that will be shown in the UI for the panel. |
|
Returns a tab name hinting at where this page should be inserted into the layer properties tab list. |
|
Returns the associated parent page, for factories which create sub-components of a standard page. |
|
Flag if widget is supported for use in layer properties dialog. |
|
Check if the layer is supported for this widget. |
|
Check if a layer tree group is supported for this widget. |
|
Flag if widget is supported for use in style dock. |
|
The title of the panel. |
- class qgis.gui.QgsMapLayerConfigWidgetFactory[source]¶
Bases:
object
- __init__()
- __init__(title: str | None, icon: QIcon)
Constructor
- Parameters:
title (Optional[str])
icon (QIcon)
- __init__(a0: QgsMapLayerConfigWidgetFactory)
- Parameters:
- class ParentPage(*values)¶
Bases:
IntEnum
Available parent pages, for factories which create a widget which is a sub-component of a standard page.
Added in version 3.20.
NoParent
: Factory creates pages itself, not sub-componentsTemporal
: Factory creates sub-components of the temporal properties page (only supported for raster layer temporal properties)
- NoParent = 0¶
- Temporal = 1¶
- abstract createWidget(self, layer: QgsMapLayer | None, canvas: QgsMapCanvas | None, dockWidget: bool = True, parent: QWidget | None = None) QgsMapLayerConfigWidget | None [source]¶
Factory function to create the widget on demand as needed by the dock.
- Parameters:
layer (Optional[QgsMapLayer]) – The active layer in the dock.
canvas (Optional[QgsMapCanvas]) – The map canvas.
dockWidget (bool = True) –
True
of the widget will be shown a dock style widget.parent (Optional[QWidget] = None) – The parent of the widget.
- Return type:
Optional[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.
- virtual icon(self) QIcon [source]¶
The icon that will be shown in the UI for the panel.
- Return type:
QIcon
- Returns:
A QIcon for the panel icon.
- virtual layerPropertiesPagePositionHint(self) str [source]¶
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.
Added in version 3.14.
- Return type:
str
- virtual parentPage(self) QgsMapLayerConfigWidgetFactory.ParentPage [source]¶
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.
Added in version 3.20.
- Return type:
- setIcon(self, icon: QIcon)[source]¶
Set the icon for the factory object.
- Parameters:
icon (QIcon) – The icon to show in the interface.
- setSupportLayerPropertiesDialog(self, supports: bool)[source]¶
Set support flag for style dock
- Parameters:
supports (bool) –
True
if this widget is supported in the style dock.
- setSupportsStyleDock(self, supports: bool)[source]¶
Set support flag for style dock
- Parameters:
supports (bool) –
True
if this widget is supported in the style dock.
- setTitle(self, title: str | None)[source]¶
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 (Optional[str]) – The title to set.
- virtual supportLayerPropertiesDialog(self) bool [source]¶
Flag if widget is supported for use in layer properties dialog. The default implementation returns
False
.- Return type:
bool
- Returns:
True
if supported
- virtual supportsLayer(self, layer: QgsMapLayer | None) bool [source]¶
Check if the layer is supported for this widget.
- Return type:
bool
- Returns:
True
if this layer is supported for this widget- Parameters:
layer (Optional[QgsMapLayer])
- virtual supportsLayerTreeGroup(self, group: QgsLayerTreeGroup | None) bool [source]¶
Check if a layer tree group is supported for this widget.
- Return type:
bool
- Returns:
True
if the group is supported for this widget
Added in version 3.24.
- Parameters:
group (Optional[QgsLayerTreeGroup])