Skip to content
Permalink
Browse files

Add api to indicate that a QgsMapLayerConfigWidgetFactory factory

creates sub-components of a standard page instead of a top-level
page on its own
  • Loading branch information
nyalldawson committed Mar 24, 2021
1 parent e350661 commit 4faceaf0d75658bd9fed1c26720db776c822becd
@@ -0,0 +1,6 @@
# The following has been generated automatically from src/gui/qgsmaplayerconfigwidgetfactory.h
# monkey patching scoped based enum
QgsMapLayerConfigWidgetFactory.ParentPage.None.__doc__ = "Factory creates pages itself, not sub-components"
QgsMapLayerConfigWidgetFactory.ParentPage.Temporal.__doc__ = "Factory creates sub-components of the temporal properties page"
QgsMapLayerConfigWidgetFactory.ParentPage.__doc__ = 'Available parent pages, for factories which create a widget which is a sub-component\nof a standard page.\n\n.. versionadded:: 3.20\n\n' + '* ``None``: ' + QgsMapLayerConfigWidgetFactory.ParentPage.None.__doc__ + '\n' + '* ``Temporal``: ' + QgsMapLayerConfigWidgetFactory.ParentPage.Temporal.__doc__
# --
@@ -22,6 +22,12 @@ Factory class for creating custom map layer property pages
%End
public:

enum class ParentPage
{
None,
Temporal,
};

QgsMapLayerConfigWidgetFactory();
%Docstring
Constructor
@@ -120,6 +126,16 @@ Set support flag for style dock
Check if the layer is supported for this widget.

:return: ``True`` if this layer is supported for this widget
%End

virtual ParentPage parentPage() const;
%Docstring
Returns the associated parent page, for factories which create sub-components of a standard page.

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

.. versionadded:: 3.20
%End

virtual QgsMapLayerConfigWidget *createWidget( QgsMapLayer *layer, QgsMapCanvas *canvas, bool dockWidget = true, QWidget *parent = 0 ) const = 0 /Factory/;
@@ -31,3 +31,8 @@ bool QgsMapLayerConfigWidgetFactory::supportsLayer( QgsMapLayer *layer ) const
Q_UNUSED( layer )
return true;
}

QgsMapLayerConfigWidgetFactory::ParentPage QgsMapLayerConfigWidgetFactory::parentPage() const
{
return ParentPage::None;
}
@@ -34,6 +34,18 @@ class GUI_EXPORT QgsMapLayerConfigWidgetFactory
{
public:

/**
* Available parent pages, for factories which create a widget which is a sub-component
* of a standard page.
*
* \since QGIS 3.20
*/
enum class ParentPage : int
{
None, //!< Factory creates pages itself, not sub-components
Temporal, //!< Factory creates sub-components of the temporal properties page
};

//! Constructor
QgsMapLayerConfigWidgetFactory() = default;

@@ -115,6 +127,16 @@ class GUI_EXPORT QgsMapLayerConfigWidgetFactory
*/
virtual bool supportsLayer( QgsMapLayer *layer ) const;

/**
* Returns the associated parent page, for factories which create sub-components of a standard page.
*
* The default implementation returns QgsMapLayerConfigWidgetFactory::ParentPage::None, indicating that the
* factory creates top-level pages which are not subcomponents.
*
* \since QGIS 3.20
*/
virtual ParentPage parentPage() const;

/**
* \brief Factory function to create the widget on demand as needed by the dock.
* \param layer The active layer in the dock.

0 comments on commit 4faceaf

Please sign in to comment.