mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-10 00:04:23 -04:00
when configuring a new algorithm While the previous behaviour of defaulting to a static value makes sense for things like numeric parameters, this is a very rare use case for map layer parameters. For better new user experience we can default instead to showing model inputs for these parameter types.
193 lines
6.4 KiB
Plaintext
193 lines
6.4 KiB
Plaintext
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/gui/processing/qgsprocessingmodelerparameterwidget.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class QgsProcessingModelerParameterWidget : QWidget, QgsExpressionContextGenerator
|
|
{
|
|
%Docstring(signature="appended")
|
|
|
|
A widget for customising the value of Processing algorithm parameter inside
|
|
a Processing model.
|
|
|
|
The widget provides choice of the linked source for values for the parameter
|
|
inside the model. E.g. parameters can be a static value, an evaluated
|
|
expression results, the output from another child algorithm, or an input
|
|
parameter for the model itself.
|
|
|
|
Individual modeler parameter widgets are not usually created directly, instead they are
|
|
constructed through the central registry, via calls to
|
|
:py:func:`QgsGui.processingGuiRegistry()`->:py:func:`~createModelerParameterWidget`.
|
|
|
|
.. versionadded:: 3.4
|
|
%End
|
|
|
|
%TypeHeaderCode
|
|
#include "qgsprocessingmodelerparameterwidget.h"
|
|
%End
|
|
public:
|
|
|
|
QgsProcessingModelerParameterWidget( QgsProcessingModelAlgorithm *model,
|
|
const QString &childId,
|
|
const QgsProcessingParameterDefinition *parameter,
|
|
QgsProcessingContext &context,
|
|
QWidget *parent /TransferThis/ = 0 );
|
|
%Docstring
|
|
Constructor for QgsProcessingModelerParameterWidget, for the specified
|
|
``parameter`` definition within the given ``model``.
|
|
|
|
The ID of the child algorithm within the model must be specified via the ``childId``
|
|
argument. This value corresponds to the :py:func:`QgsProcessingModelChildAlgorithm.childId()`
|
|
string, which uniquely identifies which child algorithm the parameter is associated
|
|
with inside the given ``model``.
|
|
|
|
A Processing ``context`` must also be specified, which allows the widget
|
|
to resolve parameter values which are context dependent. The context must
|
|
last for the lifetime of the widget.
|
|
%End
|
|
|
|
~QgsProcessingModelerParameterWidget();
|
|
|
|
void setWidgetContext( const QgsProcessingParameterWidgetContext &context );
|
|
%Docstring
|
|
Sets the ``context`` in which the modeler parameter widget is shown, e.g., the
|
|
parent model algorithm and other relevant information which allows the widget
|
|
to fine-tune its behavior.
|
|
%End
|
|
|
|
void registerProcessingContextGenerator( QgsProcessingContextGenerator *generator );
|
|
%Docstring
|
|
Registers a Processing context ``generator`` class that will be used to retrieve
|
|
a Processing context for the widget when required.
|
|
%End
|
|
|
|
void populateSources( const QStringList &compatibleParameterTypes,
|
|
const QStringList &compatibleOutputTypes,
|
|
const QList< int > &compatibleDataTypes );
|
|
%Docstring
|
|
Populates the widget with available sources for the parameter's value, e.g.
|
|
adding the available child algorithm outputs and model input parameter
|
|
choices.
|
|
|
|
In order to determine the available source, the ``compatibleParameterTypes`` and
|
|
``compatibleOutputTypes`` arguments are used. These lists correspond to the
|
|
various available values for :py:func:`QgsProcessingParameterDefinition.type()` (for
|
|
``compatibleParameterTypes``) and the values for :py:func:`QgsProcessingOutputDefinition.type()`
|
|
(for ``compatibleOutputTypes``).
|
|
|
|
The ``compatibleDataTypes`` list corresponds to the compatible data types
|
|
from :py:class:`QgsProcessing`.SourceType.
|
|
%End
|
|
|
|
void setExpressionHelpText( const QString &text );
|
|
%Docstring
|
|
Set the expected expression format ``text``, which is shown in the expression builder dialog for the widget
|
|
when in the "pre-calculated" expression mode. This is purely a text format and no expression validation is made
|
|
against it.
|
|
%End
|
|
|
|
const QgsProcessingParameterDefinition *parameterDefinition() const;
|
|
%Docstring
|
|
Returns the parameter definition associated with this wrapper.
|
|
%End
|
|
|
|
QLabel *createLabel() /Factory/;
|
|
%Docstring
|
|
Creates a label for use identifying the associated parameter.
|
|
|
|
The caller takes ownership of the returned value.
|
|
%End
|
|
|
|
virtual void setWidgetValue( const QgsProcessingModelChildParameterSource &value );
|
|
%Docstring
|
|
Sets the current ``value`` for the parameter.
|
|
|
|
.. seealso:: :py:func:`value`
|
|
%End
|
|
|
|
void setWidgetValue( const QList< QgsProcessingModelChildParameterSource > &values );
|
|
%Docstring
|
|
Sets the current ``values`` for the parameter.
|
|
|
|
.. seealso:: :py:func:`value`
|
|
|
|
.. versionadded:: 3.14
|
|
%End
|
|
|
|
void setToModelOutput( const QString &value );
|
|
%Docstring
|
|
Sets the widget to a model output, for destination parameters only.
|
|
|
|
.. seealso:: :py:func:`isModelOutput`
|
|
|
|
.. seealso:: :py:func:`modelOutputName`
|
|
|
|
.. versionadded:: 3.14
|
|
%End
|
|
|
|
bool isModelOutput() const;
|
|
%Docstring
|
|
Returns ``True`` if the widget is set to the model output mode.
|
|
|
|
.. seealso:: :py:func:`setToModelOutput`
|
|
|
|
.. seealso:: :py:func:`modelOutputName`
|
|
|
|
.. versionadded:: 3.14
|
|
%End
|
|
|
|
QString modelOutputName() const;
|
|
%Docstring
|
|
Returns the model output name, if :py:func:`~QgsProcessingModelerParameterWidget.isModelOutput` is ``True``.
|
|
|
|
.. seealso:: :py:func:`setToModelOutput`
|
|
|
|
.. seealso:: :py:func:`isModelOutput`
|
|
|
|
.. versionadded:: 3.14
|
|
%End
|
|
|
|
virtual QVariant value() const;
|
|
%Docstring
|
|
Returns the current value of the parameter.
|
|
|
|
.. seealso:: :py:func:`setWidgetValue`
|
|
%End
|
|
|
|
void setDialog( QDialog *dialog );
|
|
%Docstring
|
|
Sets the parent ``dialog`` in which the widget is shown.
|
|
|
|
.. versionadded:: 3.8
|
|
%End
|
|
|
|
virtual QgsExpressionContext createExpressionContext() const;
|
|
|
|
|
|
void setSourceType( QgsProcessingModelChildParameterSource::Source type );
|
|
%Docstring
|
|
Sets the current source ``type`` for the parameter.
|
|
|
|
.. versionadded:: 3.24
|
|
%End
|
|
|
|
};
|
|
|
|
|
|
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/gui/processing/qgsprocessingmodelerparameterwidget.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
************************************************************************/
|