QGIS API Documentation 3.32.0-Lima (311a8cb8a6)
Public Types | Public Member Functions | List of all members
QgsMapLayerConfigWidgetFactory Class Referenceabstract

Factory class for creating custom map layer property pages. More...

#include <qgsmaplayerconfigwidgetfactory.h>

Public Types

enum class  ParentPage : int { NoParent , Temporal }
 Available parent pages, for factories which create a widget which is a sub-component of a standard page. More...
 

Public Member Functions

 QgsMapLayerConfigWidgetFactory ()=default
 Constructor. More...
 
 QgsMapLayerConfigWidgetFactory (const QString &title, const QIcon &icon)
 Constructor. More...
 
virtual ~QgsMapLayerConfigWidgetFactory ()=default
 
virtual QgsMapLayerConfigWidgetcreateWidget (QgsMapLayer *layer, QgsMapCanvas *canvas, bool dockWidget=true, QWidget *parent=nullptr) const =0
 Factory function to create the widget on demand as needed by the dock. More...
 
virtual QIcon icon () const
 The icon that will be shown in the UI for the panel. More...
 
virtual QString layerPropertiesPagePositionHint () const
 Returns a tab name hinting at where this page should be inserted into the layer properties tab list. More...
 
virtual ParentPage parentPage () const
 Returns the associated parent page, for factories which create sub-components of a standard page. More...
 
void setIcon (const QIcon &icon)
 Set the icon for the factory object. More...
 
void setSupportLayerPropertiesDialog (bool supports)
 Set support flag for style dock. More...
 
void setSupportsStyleDock (bool supports)
 Set support flag for style dock. More...
 
void setTitle (const QString &title)
 Set the title for the interface. More...
 
virtual bool supportLayerPropertiesDialog () const
 Flag if widget is supported for use in layer properties dialog. More...
 
virtual bool supportsLayer (QgsMapLayer *layer) const
 Check if the layer is supported for this widget. More...
 
virtual bool supportsLayerTreeGroup (QgsLayerTreeGroup *group) const
 Check if a layer tree group is supported for this widget. More...
 
virtual bool supportsStyleDock () const
 Flag if widget is supported for use in style dock. More...
 
virtual QString title () const
 The title of the panel. More...
 

Detailed Description

Factory class for creating custom map layer property pages.

Since
QGIS 2.16

Definition at line 34 of file qgsmaplayerconfigwidgetfactory.h.

Member Enumeration Documentation

◆ ParentPage

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

Since
QGIS 3.20
Enumerator
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)

Definition at line 44 of file qgsmaplayerconfigwidgetfactory.h.

Constructor & Destructor Documentation

◆ QgsMapLayerConfigWidgetFactory() [1/2]

QgsMapLayerConfigWidgetFactory::QgsMapLayerConfigWidgetFactory ( )
default

Constructor.

◆ QgsMapLayerConfigWidgetFactory() [2/2]

QgsMapLayerConfigWidgetFactory::QgsMapLayerConfigWidgetFactory ( const QString &  title,
const QIcon &  icon 
)

Constructor.

Definition at line 18 of file qgsmaplayerconfigwidgetfactory.cpp.

◆ ~QgsMapLayerConfigWidgetFactory()

virtual QgsMapLayerConfigWidgetFactory::~QgsMapLayerConfigWidgetFactory ( )
virtualdefault

Member Function Documentation

◆ createWidget()

virtual QgsMapLayerConfigWidget * QgsMapLayerConfigWidgetFactory::createWidget ( QgsMapLayer layer,
QgsMapCanvas canvas,
bool  dockWidget = true,
QWidget *  parent = nullptr 
) const
pure virtual

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

Parameters
layerThe active layer in the dock.
canvasThe map canvas.
dockWidgettrue of the widget will be shown a dock style widget.
parentThe parent of the widget.
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()

virtual QIcon QgsMapLayerConfigWidgetFactory::icon ( ) const
inlinevirtual

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

Returns
A QIcon for the panel icon.

Definition at line 62 of file qgsmaplayerconfigwidgetfactory.h.

◆ layerPropertiesPagePositionHint()

QString QgsMapLayerConfigWidgetFactory::layerPropertiesPagePositionHint ( ) const
virtual

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.

Since
QGIS 3.14

Definition at line 24 of file qgsmaplayerconfigwidgetfactory.cpp.

◆ parentPage()

QgsMapLayerConfigWidgetFactory::ParentPage QgsMapLayerConfigWidgetFactory::parentPage ( ) const
virtual

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.

Since
QGIS 3.20

Definition at line 40 of file qgsmaplayerconfigwidgetfactory.cpp.

◆ setIcon()

void QgsMapLayerConfigWidgetFactory::setIcon ( const QIcon &  icon)
inline

Set the icon for the factory object.

Parameters
iconThe icon to show in the interface.

Definition at line 68 of file qgsmaplayerconfigwidgetfactory.h.

◆ setSupportLayerPropertiesDialog()

void QgsMapLayerConfigWidgetFactory::setSupportLayerPropertiesDialog ( bool  supports)
inline

Set support flag for style dock.

Parameters
supportstrue if this widget is supported in the style dock.

Definition at line 123 of file qgsmaplayerconfigwidgetfactory.h.

◆ setSupportsStyleDock()

void QgsMapLayerConfigWidgetFactory::setSupportsStyleDock ( bool  supports)
inline

Set support flag for style dock.

Parameters
supportstrue if this widget is supported in the style dock.

Definition at line 96 of file qgsmaplayerconfigwidgetfactory.h.

◆ setTitle()

void QgsMapLayerConfigWidgetFactory::setTitle ( const QString &  title)
inline

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
titleThe title to set.

Definition at line 83 of file qgsmaplayerconfigwidgetfactory.h.

◆ supportLayerPropertiesDialog()

virtual bool QgsMapLayerConfigWidgetFactory::supportLayerPropertiesDialog ( ) const
inlinevirtual

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

The default implementation returns false.

Returns
true if supported

Definition at line 103 of file qgsmaplayerconfigwidgetfactory.h.

◆ supportsLayer()

bool QgsMapLayerConfigWidgetFactory::supportsLayer ( QgsMapLayer layer) const
virtual

Check if the layer is supported for this widget.

Returns
true if this layer is supported for this widget

Definition at line 29 of file qgsmaplayerconfigwidgetfactory.cpp.

◆ supportsLayerTreeGroup()

bool QgsMapLayerConfigWidgetFactory::supportsLayerTreeGroup ( QgsLayerTreeGroup group) const
virtual

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

Returns
true if the group is supported for this widget
Since
QGIS 3.24

Definition at line 35 of file qgsmaplayerconfigwidgetfactory.cpp.

◆ supportsStyleDock()

virtual bool QgsMapLayerConfigWidgetFactory::supportsStyleDock ( ) const
inlinevirtual

Flag if widget is supported for use in style dock.

The default implementation returns false.

Returns
true if supported

Definition at line 90 of file qgsmaplayerconfigwidgetfactory.h.

◆ title()

virtual QString QgsMapLayerConfigWidgetFactory::title ( ) const
inlinevirtual

The title of the panel.

Returns
Title of the panel
Note
This may or may not be shown to the user.

Definition at line 75 of file qgsmaplayerconfigwidgetfactory.h.


The documentation for this class was generated from the following files: