QGIS API Documentation  3.14.0-Pi (9f7028fd23)
qgsprocessingwidgetwrapper.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsprocessingwidgetwrapper.cpp
3  ---------------------
4  begin : August 2018
5  copyright : (C) 2018 by Nyall Dawson
6  email : nyall dot dawson at gmail dot com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 
23 #include "qgsexpressioncontext.h"
24 #include "models/qgsprocessingmodelalgorithm.h"
27 #include <QLabel>
28 #include <QHBoxLayout>
29 
30 //
31 // QgsProcessingParameterWidgetContext
32 //
33 
35 {
36  mMapCanvas = canvas;
37 }
38 
40 {
41  return mMapCanvas;
42 }
43 
45 {
46  mMessageBar = bar;
47 }
48 
50 {
51  return mMessageBar;
52 }
53 
55 {
56  mBrowserModel = model;
57 }
58 
60 {
61  return mBrowserModel;
62 }
63 
65 {
66  mProject = project;
67 }
68 
70 {
71  return mProject;
72 }
73 
75 {
76  return mModelChildAlgorithmId;
77 }
78 
79 void QgsProcessingParameterWidgetContext::setModelChildAlgorithmId( const QString &modelChildAlgorithmId )
80 {
81  mModelChildAlgorithmId = modelChildAlgorithmId;
82 }
83 
85 {
86  return mActiveLayer;
87 }
88 
90 {
91  mActiveLayer = activeLayer;
92 }
93 
94 QgsProcessingModelAlgorithm *QgsProcessingParameterWidgetContext::model() const
95 {
96  return mModel;
97 }
98 
99 void QgsProcessingParameterWidgetContext::setModel( QgsProcessingModelAlgorithm *model )
100 {
101  mModel = model;
102 }
103 
104 
105 //
106 // QgsAbstractProcessingParameterWidgetWrapper
107 //
108 
110  : QObject( parent )
111  , mType( type )
112  , mParameterDefinition( parameter )
113 {
114 }
115 
117 {
118  return mType;
119 }
120 
122 {
123  mWidgetContext = context;
124 }
125 
127 {
128  return mWidgetContext;
129 }
130 
132 {
133  if ( mWidget )
134  return mWidget;
135 
136  mWidget = createWidget();
137  QWidget *wrappedWidget = mWidget;
138  if ( mParameterDefinition->isDynamic() )
139  {
140  QHBoxLayout *hLayout = new QHBoxLayout();
141  hLayout->setMargin( 0 );
142  hLayout->setContentsMargins( 0, 0, 0, 0 );
143  hLayout->addWidget( mWidget, 1 );
144  mPropertyButton = new QgsPropertyOverrideButton();
145  hLayout->addWidget( mPropertyButton );
146  mPropertyButton->init( 0, QgsProperty(), mParameterDefinition->dynamicPropertyDefinition() );
147  mPropertyButton->registerEnabledWidget( mWidget, false );
148  mPropertyButton->registerExpressionContextGenerator( this );
149 
150  wrappedWidget = new QWidget();
151  wrappedWidget->setLayout( hLayout );
152  }
153 
154  if ( !dynamic_cast<const QgsProcessingDestinationParameter * >( mParameterDefinition ) )
155  {
156  // an exception -- output widgets handle this themselves
157  setWidgetValue( mParameterDefinition->defaultValue(), context );
158  }
159 
160  return wrappedWidget;
161 }
162 
164 {
165  if ( mLabel )
166  return mLabel;
167 
168  mLabel = createLabel();
169  return mLabel;
170 }
171 
173 {
174  return mWidget;
175 }
176 
178 {
179  return mLabel;
180 }
181 
183 {
184  return mParameterDefinition;
185 }
186 
188 {
189  if ( mPropertyButton && value.canConvert< QgsProperty >() )
190  {
191  mPropertyButton->setToProperty( value.value< QgsProperty >() );
192  }
193  else
194  {
195  if ( mPropertyButton )
196  mPropertyButton->setToProperty( QgsProperty() );
197 
198  setWidgetValue( value, context );
199  }
200 }
201 
203 {
204  if ( mPropertyButton && mPropertyButton->isActive() )
205  return mPropertyButton->toProperty();
206  else
207  return widgetValue();
208 }
209 
211 {
212  return QVariantMap();
213 }
214 
216 {
217  mProcessingContextGenerator = generator;
218 }
219 
221 {
222  mParametersGenerator = generator;
223 }
224 
226 {
227  switch ( mType )
228  {
230  return nullptr;
231 
234  {
235  QString description = mParameterDefinition->description();
237  description = QObject::tr( "%1 [optional]" ).arg( description );
238  std::unique_ptr< QLabel > label = qgis::make_unique< QLabel >( description );
239  label->setToolTip( mParameterDefinition->toolTip() );
240  return label.release();
241  }
242  }
243  return nullptr;
244 }
245 
247 {
248  if ( mPropertyButton )
249  return mPropertyButton->vectorLayer();
250  return nullptr;
251 }
252 
253 void QgsAbstractProcessingParameterWidgetWrapper::postInitialize( const QList<QgsAbstractProcessingParameterWidgetWrapper *> &wrappers )
254 {
255  switch ( mType )
256  {
259  {
260  if ( parameterDefinition()->isDynamic() )
261  {
262  for ( const QgsAbstractProcessingParameterWidgetWrapper *wrapper : wrappers )
263  {
264  if ( wrapper->parameterDefinition()->name() == parameterDefinition()->dynamicLayerParameterName() )
265  {
266  setDynamicParentLayerParameter( wrapper );
267  connect( wrapper, &QgsAbstractProcessingParameterWidgetWrapper::widgetValueHasChanged, this, &QgsAbstractProcessingParameterWidgetWrapper::parentLayerChanged );
268  break;
269  }
270  }
271  }
272  break;
273  }
274 
276  break;
277  }
278 }
279 
281 {
282  return 0;
283 }
284 
286 {
287  QgsExpressionContext context = QgsProcessingGuiUtils::createExpressionContext( mProcessingContextGenerator, mWidgetContext, mParameterDefinition ? mParameterDefinition->algorithm() : nullptr, linkedVectorLayer() );
288  if ( mParameterDefinition && !mParameterDefinition->additionalExpressionContextVariables().isEmpty() )
289  {
290  std::unique_ptr< QgsExpressionContextScope > paramScope = qgis::make_unique< QgsExpressionContextScope >();
291  const QStringList additional = mParameterDefinition->additionalExpressionContextVariables();
292  for ( const QString &var : additional )
293  {
294  paramScope->setVariable( var, QVariant() );
295  }
296  context.appendScope( paramScope.release() );
297 
298  // we always highlight additional variables for visibility
299  QStringList highlighted = context.highlightedVariables();
300  highlighted.append( additional );
301  context.setHighlightedVariables( highlighted );
302  }
303  return context;
304 }
305 
307 {
308 
309 }
310 
311 void QgsAbstractProcessingParameterWidgetWrapper::parentLayerChanged( QgsAbstractProcessingParameterWidgetWrapper *wrapper )
312 {
313  if ( wrapper )
314  {
315  setDynamicParentLayerParameter( wrapper );
316  }
317 }
318 
319 void QgsAbstractProcessingParameterWidgetWrapper::setDynamicParentLayerParameter( const QgsAbstractProcessingParameterWidgetWrapper *parentWrapper )
320 {
321  if ( mPropertyButton )
322  {
323  // evaluate value to layer
324  QgsProcessingContext *context = nullptr;
325  std::unique_ptr< QgsProcessingContext > tmpContext;
328 
329  if ( !context )
330  {
331  tmpContext = qgis::make_unique< QgsProcessingContext >();
332  context = tmpContext.get();
333  }
334 
335  QgsVectorLayer *layer = QgsProcessingParameters::parameterAsVectorLayer( parentWrapper->parameterDefinition(), parentWrapper->parameterValue(), *context );
336  if ( !layer )
337  {
338  mPropertyButton->setVectorLayer( nullptr );
339  return;
340  }
341 
342  // need to grab ownership of layer if required - otherwise layer may be deleted when context
343  // goes out of scope
344  std::unique_ptr< QgsMapLayer > ownedLayer( context->takeResultLayer( layer->id() ) );
345  if ( ownedLayer && ownedLayer->type() == QgsMapLayerType::VectorLayer )
346  {
347  mDynamicLayer.reset( qobject_cast< QgsVectorLayer * >( ownedLayer.release() ) );
348  layer = mDynamicLayer.get();
349  }
350  else
351  {
352  // don't need ownership of this layer - it wasn't owned by context (so e.g. is owned by the project)
353  }
354 
355  mPropertyButton->setVectorLayer( layer );
356  }
357 }
358 
360 {
361  std::unique_ptr< QgsProcessingModelerParameterWidget > widget = qgis::make_unique< QgsProcessingModelerParameterWidget >( model, childId, parameter, context );
362  widget->populateSources( compatibleParameterTypes(), compatibleOutputTypes(), compatibleDataTypes( parameter ) );
363  widget->setExpressionHelpText( modelerExpressionFormatString() );
364  return widget.release();
365 }
366 
369  const QgsProcessingAlgorithm * )
370 {
371  return nullptr;
372 }
373 
375 {
376  return QList< int >();
377 }
378 
380 {
381  return QString();
382 }
383 
384 //
385 // QgsProcessingGuiUtils
386 //
387 
389 QgsExpressionContext QgsProcessingGuiUtils::createExpressionContext( QgsProcessingContextGenerator *processingContextGenerator, const QgsProcessingParameterWidgetContext &widgetContext, const QgsProcessingAlgorithm *algorithm, const QgsVectorLayer *linkedLayer )
390 {
391  // Get a processing context to start with
392  QgsProcessingContext *context = nullptr;
393  std::unique_ptr< QgsProcessingContext > tmpContext;
394  if ( processingContextGenerator )
395  context = processingContextGenerator->processingContext();
396 
397  if ( !context )
398  {
399  tmpContext = qgis::make_unique< QgsProcessingContext >();
400  context = tmpContext.get();
401  }
402 
404 
405  if ( widgetContext.model() )
406  {
407  c << QgsExpressionContextUtils::processingModelAlgorithmScope( widgetContext.model(), QVariantMap(), *context );
408 
409  const QgsProcessingAlgorithm *alg = nullptr;
410  if ( widgetContext.model()->childAlgorithms().contains( widgetContext.modelChildAlgorithmId() ) )
411  alg = widgetContext.model()->childAlgorithm( widgetContext.modelChildAlgorithmId() ).algorithm();
412 
413  QgsExpressionContextScope *algorithmScope = QgsExpressionContextUtils::processingAlgorithmScope( alg ? alg : algorithm, QVariantMap(), *context );
414  c << algorithmScope;
415  QgsExpressionContextScope *childScope = widgetContext.model()->createExpressionContextScopeForChildAlgorithm( widgetContext.modelChildAlgorithmId(), *context, QVariantMap(), QVariantMap() );
416  c << childScope;
417 
418  QStringList highlightedVariables = childScope->variableNames();
419  QStringList highlightedFunctions = childScope->functionNames();
420  highlightedVariables += algorithmScope->variableNames();
421  highlightedVariables += widgetContext.model()->variables().keys();
422  highlightedFunctions += algorithmScope->functionNames();
423  c.setHighlightedVariables( highlightedVariables );
424  c.setHighlightedFunctions( highlightedFunctions );
425  }
426  else
427  {
428  if ( algorithm )
429  c << QgsExpressionContextUtils::processingAlgorithmScope( algorithm, QVariantMap(), *context );
430  }
431 
432  if ( linkedLayer )
433  c << QgsExpressionContextUtils::layerScope( linkedLayer );
434 
435  return c;
436 }
QgsExpressionContext
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Definition: qgsexpressioncontext.h:369
QgsProcessingParameterWidgetContext::activeLayer
QgsMapLayer * activeLayer() const
Returns the current active layer.
Definition: qgsprocessingwidgetwrapper.cpp:84
QgsProcessingParameterWidgetContext
Definition: qgsprocessingwidgetwrapper.h:99
qgsexpressioncontextutils.h
QgsAbstractProcessingParameterWidgetWrapper::createWidget
virtual QWidget * createWidget()=0
Creates a new widget which allows customization of the parameter's value.
QgsProperty
A store for object properties.
Definition: qgsproperty.h:231
QgsProcessingParameterWidgetContext::setModelChildAlgorithmId
void setModelChildAlgorithmId(const QString &id)
Sets the child algorithm id within the model which the parameter widget is associated with.
Definition: qgsprocessingwidgetwrapper.cpp:79
QgsMapLayerType::VectorLayer
@ VectorLayer
QgsProcessingParameterDefinition::description
QString description() const
Returns the description for the parameter.
Definition: qgsprocessingparameters.h:470
QgsProcessingParameterWidgetContext::mapCanvas
QgsMapCanvas * mapCanvas() const
Returns the map canvas associated with the widget.
Definition: qgsprocessingwidgetwrapper.cpp:39
algorithm
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into allowing algorithms to be written in pure substantial changes are required in order to port existing x Processing algorithms for QGIS x The most significant changes are outlined not GeoAlgorithm For algorithms which operate on features one by consider subclassing the QgsProcessingFeatureBasedAlgorithm class This class allows much of the boilerplate code for looping over features from a vector layer to be bypassed and instead requires implementation of a processFeature method Ensure that your algorithm(or algorithm 's parent class) implements the new pure virtual createInstance(self) call
QgsProcessingContext::takeResultLayer
QgsMapLayer * takeResultLayer(const QString &id)
Takes the result map layer with matching id from the context and transfers ownership of it back to th...
Definition: qgsprocessingcontext.cpp:108
QgsProcessingParameterWidgetContext::setModel
void setModel(QgsProcessingModelAlgorithm *model)
Sets the model which the parameter widget is associated with.
Definition: qgsprocessingwidgetwrapper.cpp:99
QgsAbstractProcessingParameterWidgetWrapper::createWrappedWidget
QWidget * createWrappedWidget(QgsProcessingContext &context)
Creates and return a new wrapped widget which allows customization of the parameter's value.
Definition: qgsprocessingwidgetwrapper.cpp:131
QgsAbstractProcessingParameterWidgetWrapper::setWidgetContext
virtual void setWidgetContext(const QgsProcessingParameterWidgetContext &context)
Sets the context in which the Processing parameter widget is shown, e.g., the parent model algorithm,...
Definition: qgsprocessingwidgetwrapper.cpp:121
QgsExpressionContextUtils::layerScope
static QgsExpressionContextScope * layerScope(const QgsMapLayer *layer)
Creates a new scope which contains variables and functions relating to a QgsMapLayer.
Definition: qgsexpressioncontextutils.cpp:264
QgsAbstractProcessingParameterWidgetWrapper::registerProcessingParametersGenerator
void registerProcessingParametersGenerator(QgsProcessingParametersGenerator *generator)
Registers a Processing parameters generator class that will be used to retrieve algorithm parameters ...
Definition: qgsprocessingwidgetwrapper.cpp:220
QgsMapCanvas
Definition: qgsmapcanvas.h:83
QgsProcessingParameterWidgetContext::setMessageBar
void setMessageBar(QgsMessageBar *bar)
Sets the message bar associated with the widget.
Definition: qgsprocessingwidgetwrapper.cpp:44
QgsProcessingParameterDefinition::additionalExpressionContextVariables
QStringList additionalExpressionContextVariables() const
Returns a list of additional expression context variables which are available for use when evaluating...
Definition: qgsprocessingparameters.h:671
QgsAbstractProcessingParameterWidgetWrapper::mParametersGenerator
QgsProcessingParametersGenerator * mParametersGenerator
Definition: qgsprocessingwidgetwrapper.h:477
QgsProcessingParameterDefinition
Definition: qgsprocessingparameters.h:330
QgsProcessingParameterDefinition::isDynamic
bool isDynamic() const
Returns true if the parameter supports is dynamic, and can support data-defined values (i....
Definition: qgsprocessingparameters.h:605
QgsAbstractProcessingParameterWidgetWrapper
Definition: qgsprocessingwidgetwrapper.h:266
QgsAbstractProcessingParameterWidgetWrapper::wrappedLabel
QLabel * wrappedLabel()
Returns the current wrapped label, if any.
Definition: qgsprocessingwidgetwrapper.cpp:177
QgsProcessingParameterWidgetContext::setActiveLayer
void setActiveLayer(QgsMapLayer *layer)
Sets the current active layer.
Definition: qgsprocessingwidgetwrapper.cpp:89
QgsProject
Definition: qgsproject.h:92
QgsProcessingGui::Standard
@ Standard
Standard algorithm dialog.
Definition: qgsprocessinggui.h:40
QgsExpressionContextScope::variableNames
QStringList variableNames() const
Returns a list of variable names contained within the scope.
Definition: qgsexpressioncontext.cpp:113
QgsPropertyOverrideButton
Definition: qgspropertyoverridebutton.h:50
QgsProcessingParameterWidgetContext::setMapCanvas
void setMapCanvas(QgsMapCanvas *canvas)
Sets the map canvas associated with the widget.
Definition: qgsprocessingwidgetwrapper.cpp:34
QgsAbstractProcessingParameterWidgetWrapper::stretch
virtual int stretch() const
Returns the Qt layout "stretch" factor to use when adding this widget to a layout.
Definition: qgsprocessingwidgetwrapper.cpp:280
QgsAbstractProcessingParameterWidgetWrapper::createWrappedLabel
QLabel * createWrappedLabel()
Creates and returns a new label to accompany widgets created by the wrapper.
Definition: qgsprocessingwidgetwrapper.cpp:163
QgsProcessingDestinationParameter
Definition: qgsprocessingparameters.h:2652
QgsProcessingParameterWidgetContext::modelChildAlgorithmId
QString modelChildAlgorithmId() const
Returns the child algorithm ID within the model which the parameter widget is associated with.
Definition: qgsprocessingwidgetwrapper.cpp:74
qgsexpressioncontext.h
QgsProcessingParameterWidgetContext::project
QgsProject * project() const
Returns the project associated with the widget.
Definition: qgsprocessingwidgetwrapper.cpp:69
QgsAbstractProcessingParameterWidgetWrapper::setWidgetValue
virtual void setWidgetValue(const QVariant &value, QgsProcessingContext &context)=0
Sets the current value for the parameter to show in the widget.
QgsProcessingParameterWidgetFactoryInterface::modelerExpressionFormatString
virtual QString modelerExpressionFormatString() const
Returns the expected expression format string for expression results for the parameter within model c...
Definition: qgsprocessingwidgetwrapper.cpp:379
qgsprocessingmodelerparameterwidget.h
QgsProcessingParameters::parameterAsVectorLayer
static QgsVectorLayer * parameterAsVectorLayer(const QgsProcessingParameterDefinition *definition, const QVariantMap &parameters, QgsProcessingContext &context)
Evaluates the parameter with matching definition to a vector layer.
Definition: qgsprocessingparameters.cpp:945
QgsProcessingContext
Definition: qgsprocessingcontext.h:43
QgsProcessingParameterDefinition::toolTip
virtual QString toolTip() const
Returns a formatted tooltip for use with the parameter, which gives helpful information like paramete...
Definition: qgsprocessingparameters.cpp:2208
QgsProcessingParameterDefinition::algorithm
QgsProcessingAlgorithm * algorithm() const
Returns a pointer to the algorithm which owns this parameter.
Definition: qgsprocessingparameters.cpp:2198
QgsProcessingGui::Batch
@ Batch
Batch processing dialog.
Definition: qgsprocessinggui.h:41
QgsProcessingParameterWidgetFactoryInterface::compatibleDataTypes
virtual QList< int > compatibleDataTypes(const QgsProcessingParameterDefinition *parameter) const
Returns a list of compatible Processing data types for inputs for this widget for the specified param...
Definition: qgsprocessingwidgetwrapper.cpp:374
QgsAbstractProcessingParameterWidgetWrapper::createExpressionContext
QgsExpressionContext createExpressionContext() const override
This method needs to be reimplemented in all classes which implement this interface and return an exp...
Definition: qgsprocessingwidgetwrapper.cpp:285
QgsExpressionContextUtils::processingAlgorithmScope
static QgsExpressionContextScope * processingAlgorithmScope(const QgsProcessingAlgorithm *algorithm, const QVariantMap &parameters, QgsProcessingContext &context)
Creates a new scope which contains variables and functions relating to a processing algorithm,...
Definition: qgsexpressioncontextutils.cpp:760
qgsprocessingwidgetwrapper.h
QgsMessageBar
Definition: qgsmessagebar.h:60
QgsAbstractProcessingParameterWidgetWrapper::QgsAbstractProcessingParameterWidgetWrapper
QgsAbstractProcessingParameterWidgetWrapper(const QgsProcessingParameterDefinition *parameter=nullptr, QgsProcessingGui::WidgetType type=QgsProcessingGui::Standard, QObject *parent=nullptr)
Constructor for QgsAbstractProcessingParameterWidgetWrapper, for the specified parameter definition a...
Definition: qgsprocessingwidgetwrapper.cpp:109
QgsProcessingModelerParameterWidget
Definition: qgsprocessingmodelerparameterwidget.h:61
QgsExpressionContextUtils::processingModelAlgorithmScope
static QgsExpressionContextScope * processingModelAlgorithmScope(const QgsProcessingModelAlgorithm *model, const QVariantMap &parameters, QgsProcessingContext &context)
Creates a new scope which contains variables and functions relating to a processing model algorithm,...
Definition: qgsexpressioncontextutils.cpp:777
QgsMapLayer::id
QString id() const
Returns the layer's unique ID, which is used to access this layer from QgsProject.
Definition: qgsmaplayer.cpp:148
QgsProcessingParametersGenerator
Definition: qgsprocessingwidgetwrapper.h:76
QgsProcessingGui::Modeler
@ Modeler
Modeler dialog.
Definition: qgsprocessinggui.h:42
QgsAbstractProcessingParameterWidgetWrapper::widgetValueHasChanged
void widgetValueHasChanged(QgsAbstractProcessingParameterWidgetWrapper *wrapper)
Emitted whenever the parameter value (as defined by the wrapped widget) is changed.
qgsprocessingwidgetwrapperimpl.h
QgsAbstractProcessingParameterWidgetWrapper::type
QgsProcessingGui::WidgetType type() const
Returns the dialog type for which widgets and labels will be created by this wrapper.
Definition: qgsprocessingwidgetwrapper.cpp:116
QgsAbstractProcessingParameterWidgetWrapper::linkedVectorLayer
virtual const QgsVectorLayer * linkedVectorLayer() const
Returns the optional vector layer associated with this widget wrapper, or nullptr if no vector layer ...
Definition: qgsprocessingwidgetwrapper.cpp:246
QgsAbstractProcessingParameterWidgetWrapper::registerProcessingContextGenerator
void registerProcessingContextGenerator(QgsProcessingContextGenerator *generator)
Registers a Processing context generator class that will be used to retrieve a Processing context for...
Definition: qgsprocessingwidgetwrapper.cpp:215
QgsExpressionContext::highlightedVariables
QStringList highlightedVariables() const
Returns the current list of variables highlighted within the context.
Definition: qgsexpressioncontext.cpp:319
QgsProcessingAbstractParameterDefinitionWidget
Abstract base class for widgets which allow users to specify the properties of a Processing parameter...
Definition: qgsprocessingparameterdefinitionwidget.h:43
QgsExpressionContextScope
Single scope for storing variables and functions for use within a QgsExpressionContext....
Definition: qgsexpressioncontext.h:111
QgsExpressionContext::appendScope
void appendScope(QgsExpressionContextScope *scope)
Appends a scope to the end of the context.
Definition: qgsexpressioncontext.cpp:490
QgsAbstractProcessingParameterWidgetWrapper::setParameterValue
void setParameterValue(const QVariant &value, QgsProcessingContext &context)
Sets the current value for the parameter.
Definition: qgsprocessingwidgetwrapper.cpp:187
QgsAbstractProcessingParameterWidgetWrapper::createLabel
virtual QLabel * createLabel()
Creates a new label to accompany widgets created by the wrapper.
Definition: qgsprocessingwidgetwrapper.cpp:225
qgsprocessingparameters.h
QgsAbstractProcessingParameterWidgetWrapper::wrappedWidget
QWidget * wrappedWidget()
Returns the current wrapped widget, if any.
Definition: qgsprocessingwidgetwrapper.cpp:172
QgsProcessingGui::WidgetType
WidgetType
Types of dialogs which Processing widgets can be created for.
Definition: qgsprocessinggui.h:38
QgsProcessingParameterDefinition::dynamicPropertyDefinition
QgsPropertyDefinition dynamicPropertyDefinition() const
Returns the property definition for dynamic properties.
Definition: qgsprocessingparameters.h:622
QgsProcessingAlgorithm
Definition: qgsprocessingalgorithm.h:51
c
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
Definition: porting_processing.dox:1
QgsAbstractProcessingParameterWidgetWrapper::widgetValue
virtual QVariant widgetValue() const =0
Returns the current value of the parameter.
QgsProcessingParameterWidgetContext::setProject
void setProject(QgsProject *project)
Sets the project associated with the widget.
Definition: qgsprocessingwidgetwrapper.cpp:64
QgsVectorLayer
Definition: qgsvectorlayer.h:385
QgsMapLayer
Definition: qgsmaplayer.h:81
QgsAbstractProcessingParameterWidgetWrapper::setDialog
virtual void setDialog(QDialog *dialog)
Sets the parent dialog in which the wrapper is shown.
Definition: qgsprocessingwidgetwrapper.cpp:306
QgsProcessingContext::expressionContext
QgsExpressionContext & expressionContext()
Returns the expression context.
Definition: qgsprocessingcontext.h:119
QgsAbstractProcessingParameterWidgetWrapper::parameterValue
QVariant parameterValue() const
Returns the current value of the parameter.
Definition: qgsprocessingwidgetwrapper.cpp:202
QgsProcessingParameterWidgetFactoryInterface::compatibleOutputTypes
virtual QStringList compatibleOutputTypes() const =0
Returns a list of compatible Processing output types for inputs for this parameter.
QgsAbstractProcessingParameterWidgetWrapper::mWidgetContext
QgsProcessingParameterWidgetContext mWidgetContext
Definition: qgsprocessingwidgetwrapper.h:478
QgsProcessingParameterWidgetFactoryInterface::createParameterDefinitionWidget
virtual QgsProcessingAbstractParameterDefinitionWidget * createParameterDefinitionWidget(QgsProcessingContext &context, const QgsProcessingParameterWidgetContext &widgetContext, const QgsProcessingParameterDefinition *definition=nullptr, const QgsProcessingAlgorithm *algorithm=nullptr)
Creates a new parameter definition widget allowing for configuration of an instance of the parameter ...
Definition: qgsprocessingwidgetwrapper.cpp:367
QgsProcessingParameterWidgetContext::setBrowserModel
void setBrowserModel(QgsBrowserGuiModel *model)
Sets the browser model associated with the widget.
Definition: qgsprocessingwidgetwrapper.cpp:54
QgsExpressionContext::setHighlightedVariables
void setHighlightedVariables(const QStringList &variableNames)
Sets the list of variable names within the context intended to be highlighted to the user.
Definition: qgsexpressioncontext.cpp:324
QgsAbstractProcessingParameterWidgetWrapper::mProcessingContextGenerator
QgsProcessingContextGenerator * mProcessingContextGenerator
Definition: qgsprocessingwidgetwrapper.h:476
QgsProcessingParameterWidgetContext::model
QgsProcessingModelAlgorithm * model() const
Returns the model which the parameter widget is associated with.
Definition: qgsprocessingwidgetwrapper.cpp:94
QgsProcessingParameterWidgetFactoryInterface::compatibleParameterTypes
virtual QStringList compatibleParameterTypes() const =0
Returns a list of compatible Processing parameter types for inputs for this parameter.
QgsProcessingContextGenerator::processingContext
virtual QgsProcessingContext * processingContext()=0
This method needs to be reimplemented in all classes which implement this interface and return a Proc...
QgsAbstractProcessingParameterWidgetWrapper::widgetContext
const QgsProcessingParameterWidgetContext & widgetContext() const
Returns the context in which the Processing parameter widget is shown, e.g., the parent model algorit...
Definition: qgsprocessingwidgetwrapper.cpp:126
QgsProcessingParameterDefinition::FlagOptional
@ FlagOptional
Parameter is optional.
Definition: qgsprocessingparameters.h:421
QgsProcessingParameterWidgetContext::browserModel
QgsBrowserGuiModel * browserModel() const
Returns the browser model associated with the widget.
Definition: qgsprocessingwidgetwrapper.cpp:59
QgsProcessingParameterDefinition::defaultValue
QVariant defaultValue() const
Returns the default value for the parameter.
Definition: qgsprocessingparameters.h:483
QgsProcessingParameterWidgetFactoryInterface::createModelerWidgetWrapper
virtual QgsProcessingModelerParameterWidget * createModelerWidgetWrapper(QgsProcessingModelAlgorithm *model, const QString &childId, const QgsProcessingParameterDefinition *parameter, QgsProcessingContext &context)
Creates a new modeler parameter widget for the given parameter.
Definition: qgsprocessingwidgetwrapper.cpp:359
QgsAbstractProcessingParameterWidgetWrapper::parameterDefinition
const QgsProcessingParameterDefinition * parameterDefinition() const
Returns the parameter definition associated with this wrapper.
Definition: qgsprocessingwidgetwrapper.cpp:182
QgsAbstractProcessingParameterWidgetWrapper::customProperties
virtual QVariantMap customProperties() const
Returns any custom properties set by the wrapper.
Definition: qgsprocessingwidgetwrapper.cpp:210
QgsBrowserGuiModel
Definition: qgsbrowserguimodel.h:37
qgspropertyoverridebutton.h
QgsProcessingContextGenerator
Definition: qgsprocessingwidgetwrapper.h:52
QgsProcessingParameterWidgetContext::messageBar
QgsMessageBar * messageBar() const
Returns the message bar associated with the widget.
Definition: qgsprocessingwidgetwrapper.cpp:49
QgsAbstractProcessingParameterWidgetWrapper::postInitialize
virtual void postInitialize(const QList< QgsAbstractProcessingParameterWidgetWrapper * > &wrappers)
Called after all wrappers have been created within a particular dialog or context,...
Definition: qgsprocessingwidgetwrapper.cpp:253