QGIS API Documentation 3.38.0-Grenoble (exported)
Loading...
Searching...
No Matches
qgsmodelgraphicsscene.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsmodelgraphicsscene.cpp
3 ----------------------------------
4 Date : March 2020
5 Copyright : (C) 2020 Nyall Dawson
6 Email : nyall dot dawson at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
20#include "qgsmodelarrowitem.h"
22#include "qgsmessagebar.h"
23#include "qgsmessagebaritem.h"
24#include "qgsmessageviewer.h"
25#include "qgsmessagelog.h"
26#include <QGraphicsSceneMouseEvent>
27#include <QPushButton>
28
30
31QgsModelGraphicsScene::QgsModelGraphicsScene( QObject *parent )
32 : QGraphicsScene( parent )
33{
34 setItemIndexMethod( QGraphicsScene::NoIndex );
35}
36
37QgsProcessingModelAlgorithm *QgsModelGraphicsScene::model()
38{
39 return mModel;
40}
41
42void QgsModelGraphicsScene::setModel( QgsProcessingModelAlgorithm *model )
43{
44 mModel = model;
45}
46
47void QgsModelGraphicsScene::setFlag( QgsModelGraphicsScene::Flag flag, bool on )
48{
49 if ( on )
50 mFlags |= flag;
51 else
52 mFlags &= ~flag;
53}
54
55void QgsModelGraphicsScene::mousePressEvent( QGraphicsSceneMouseEvent *event )
56{
57 if ( event->button() != Qt::LeftButton )
58 return;
59 QGraphicsScene::mousePressEvent( event );
60}
61
62QgsModelComponentGraphicItem *QgsModelGraphicsScene::createParameterGraphicItem( QgsProcessingModelAlgorithm *model, QgsProcessingModelParameter *param ) const
63{
64 return new QgsModelParameterGraphicItem( param, model, nullptr );
65}
66
67QgsModelChildAlgorithmGraphicItem *QgsModelGraphicsScene::createChildAlgGraphicItem( QgsProcessingModelAlgorithm *model, QgsProcessingModelChildAlgorithm *child ) const
68{
69 return new QgsModelChildAlgorithmGraphicItem( child, model, nullptr );
70}
71
72QgsModelComponentGraphicItem *QgsModelGraphicsScene::createOutputGraphicItem( QgsProcessingModelAlgorithm *model, QgsProcessingModelOutput *output ) const
73{
74 return new QgsModelOutputGraphicItem( output, model, nullptr );
75}
76
77QgsModelComponentGraphicItem *QgsModelGraphicsScene::createCommentGraphicItem( QgsProcessingModelAlgorithm *model, QgsProcessingModelComment *comment, QgsModelComponentGraphicItem *parentItem ) const
78{
79 return new QgsModelCommentGraphicItem( comment, parentItem, model, nullptr );
80}
81
82QgsModelComponentGraphicItem *QgsModelGraphicsScene::createGroupBoxGraphicItem( QgsProcessingModelAlgorithm *model, QgsProcessingModelGroupBox *box ) const
83{
84 return new QgsModelGroupBoxGraphicItem( box, model, nullptr );
85}
86
87void QgsModelGraphicsScene::createItems( QgsProcessingModelAlgorithm *model, QgsProcessingContext &context )
88{
89 // model group boxes
90 const QList<QgsProcessingModelGroupBox> boxes = model->groupBoxes();
91 mGroupBoxItems.clear();
92 for ( const QgsProcessingModelGroupBox &box : boxes )
93 {
94 QgsModelComponentGraphicItem *item = createGroupBoxGraphicItem( model, box.clone() );
95 addItem( item );
96 item->setPos( box.position().x(), box.position().y() );
97 mGroupBoxItems.insert( box.uuid(), item );
98 connect( item, &QgsModelComponentGraphicItem::requestModelRepaint, this, &QgsModelGraphicsScene::rebuildRequired );
99 connect( item, &QgsModelComponentGraphicItem::changed, this, &QgsModelGraphicsScene::componentChanged );
100 connect( item, &QgsModelComponentGraphicItem::aboutToChange, this, &QgsModelGraphicsScene::componentAboutToChange );
101 }
102
103 // model input parameters
104 const QMap<QString, QgsProcessingModelParameter> params = model->parameterComponents();
105 for ( auto it = params.constBegin(); it != params.constEnd(); ++it )
106 {
107 QgsModelComponentGraphicItem *item = createParameterGraphicItem( model, it.value().clone() );
108 addItem( item );
109 item->setPos( it.value().position().x(), it.value().position().y() );
110 mParameterItems.insert( it.value().parameterName(), item );
111 connect( item, &QgsModelComponentGraphicItem::requestModelRepaint, this, &QgsModelGraphicsScene::rebuildRequired );
112 connect( item, &QgsModelComponentGraphicItem::changed, this, &QgsModelGraphicsScene::componentChanged );
113 connect( item, &QgsModelComponentGraphicItem::aboutToChange, this, &QgsModelGraphicsScene::componentAboutToChange );
114
115 addCommentItemForComponent( model, it.value(), item );
116 }
117
118 // input dependency arrows
119 for ( auto it = params.constBegin(); it != params.constEnd(); ++it )
120 {
121 const QgsProcessingParameterDefinition *parameterDef = model->parameterDefinition( it.key() );
122 const QStringList parameterLinks = parameterDef->dependsOnOtherParameters();
123 for ( const QString &otherName : parameterLinks )
124 {
125 if ( mParameterItems.contains( it.key() ) && mParameterItems.contains( otherName ) )
126 {
127 std::unique_ptr< QgsModelArrowItem > arrow = std::make_unique< QgsModelArrowItem >( mParameterItems.value( otherName ), QgsModelArrowItem::Marker::Circle, mParameterItems.value( it.key() ), QgsModelArrowItem::Marker::ArrowHead );
128 arrow->setPenStyle( Qt::DotLine );
129 addItem( arrow.release() );
130 }
131 }
132 }
133
134 // child algorithms
135 const QMap<QString, QgsProcessingModelChildAlgorithm> childAlgs = model->childAlgorithms();
136 for ( auto it = childAlgs.constBegin(); it != childAlgs.constEnd(); ++it )
137 {
138 QgsModelChildAlgorithmGraphicItem *item = createChildAlgGraphicItem( model, it.value().clone() );
139 addItem( item );
140 item->setPos( it.value().position().x(), it.value().position().y() );
141
142 const QString childId = it.value().childId();
143 item->setResults( mLastResult.childResults().value( childId ) );
144 mChildAlgorithmItems.insert( childId, item );
145 connect( item, &QgsModelComponentGraphicItem::requestModelRepaint, this, &QgsModelGraphicsScene::rebuildRequired );
146 connect( item, &QgsModelComponentGraphicItem::changed, this, &QgsModelGraphicsScene::componentChanged );
147 connect( item, &QgsModelComponentGraphicItem::aboutToChange, this, &QgsModelGraphicsScene::componentAboutToChange );
148 connect( item, &QgsModelChildAlgorithmGraphicItem::runFromHere, this, [this, childId]
149 {
150 emit runFromChild( childId );
151 } );
152 connect( item, &QgsModelChildAlgorithmGraphicItem::runSelected, this, &QgsModelGraphicsScene::runSelected );
153 connect( item, &QgsModelChildAlgorithmGraphicItem::showPreviousResults, this, [this, childId]
154 {
155 emit showChildAlgorithmOutputs( childId );
156 } );
157 connect( item, &QgsModelChildAlgorithmGraphicItem::showLog, this, [this, childId]
158 {
159 emit showChildAlgorithmLog( childId );
160 } );
161
162 addCommentItemForComponent( model, it.value(), item );
163 }
164
165 // arrows linking child algorithms
166 for ( auto it = childAlgs.constBegin(); it != childAlgs.constEnd(); ++it )
167 {
168 int topIdx = 0;
169 int bottomIdx = 0;
170 if ( !it.value().algorithm() )
171 continue;
172
173 const QgsProcessingParameterDefinitions parameters = it.value().algorithm()->parameterDefinitions();
174 for ( const QgsProcessingParameterDefinition *parameter : parameters )
175 {
176 if ( !( parameter->flags() & Qgis::ProcessingParameterFlag::Hidden ) )
177 {
178 QList< QgsProcessingModelChildParameterSource > sources;
179 if ( it.value().parameterSources().contains( parameter->name() ) )
180 sources = it.value().parameterSources()[parameter->name()];
181 for ( const QgsProcessingModelChildParameterSource &source : std::as_const( sources ) )
182 {
183 const QList< LinkSource > sourceItems = linkSourcesForParameterValue( model, QVariant::fromValue( source ), it.value().childId(), context );
184 for ( const LinkSource &link : sourceItems )
185 {
186 if ( !link.item )
187 continue;
188 QgsModelArrowItem *arrow = nullptr;
189 if ( link.linkIndex == -1 )
190 arrow = new QgsModelArrowItem( link.item, QgsModelArrowItem::Marker::Circle, mChildAlgorithmItems.value( it.value().childId() ), parameter->isDestination() ? Qt::BottomEdge : Qt::TopEdge, parameter->isDestination() ? bottomIdx : topIdx, QgsModelArrowItem::Marker::Circle );
191 else
192 arrow = new QgsModelArrowItem( link.item, link.edge, link.linkIndex, true, QgsModelArrowItem::Marker::Circle,
193 mChildAlgorithmItems.value( it.value().childId() ),
194 parameter->isDestination() ? Qt::BottomEdge : Qt::TopEdge,
195 parameter->isDestination() ? bottomIdx : topIdx,
196 true,
197 QgsModelArrowItem::Marker::Circle );
198 addItem( arrow );
199 }
200 }
201 if ( parameter->isDestination() )
202 bottomIdx++;
203 else
204 topIdx++;
205 }
206 }
207 const QList< QgsProcessingModelChildDependency > dependencies = it.value().dependencies();
208 for ( const QgsProcessingModelChildDependency &depend : dependencies )
209 {
210 if ( depend.conditionalBranch.isEmpty() || !model->childAlgorithm( depend.childId ).algorithm() )
211 {
212 addItem( new QgsModelArrowItem( mChildAlgorithmItems.value( depend.childId ), QgsModelArrowItem::Marker::Circle, mChildAlgorithmItems.value( it.value().childId() ), QgsModelArrowItem::Marker::ArrowHead ) );
213 }
214 else
215 {
216 // find branch link point
217 const QgsProcessingOutputDefinitions outputs = model->childAlgorithm( depend.childId ).algorithm()->outputDefinitions();
218 int i = 0;
219 bool found = false;
220 for ( const QgsProcessingOutputDefinition *output : outputs )
221 {
222 if ( output->name() == depend.conditionalBranch )
223 {
224 found = true;
225 break;
226 }
227 i++;
228 }
229 if ( found )
230 addItem( new QgsModelArrowItem( mChildAlgorithmItems.value( depend.childId ), Qt::BottomEdge, i, QgsModelArrowItem::Marker::Circle, mChildAlgorithmItems.value( it.value().childId() ), QgsModelArrowItem::Marker::ArrowHead ) );
231 }
232 }
233 }
234
235 // and finally the model outputs
236 for ( auto it = childAlgs.constBegin(); it != childAlgs.constEnd(); ++it )
237 {
238 const QMap<QString, QgsProcessingModelOutput> outputs = it.value().modelOutputs();
239 QMap< QString, QgsModelComponentGraphicItem * > outputItems;
240
241 // offsets from algorithm item needed to correctly place output items
242 // which does not have valid position assigned (https://github.com/qgis/QGIS/issues/48132)
243 QgsProcessingModelComponent *algItem = mChildAlgorithmItems[it.value().childId()]->component();
244 const double outputOffsetX = algItem->size().width();
245 double outputOffsetY = 1.5 * algItem->size().height();
246
247 for ( auto outputIt = outputs.constBegin(); outputIt != outputs.constEnd(); ++outputIt )
248 {
249 QgsModelComponentGraphicItem *item = createOutputGraphicItem( model, outputIt.value().clone() );
250 addItem( item );
251 connect( item, &QgsModelComponentGraphicItem::requestModelRepaint, this, &QgsModelGraphicsScene::rebuildRequired );
252 connect( item, &QgsModelComponentGraphicItem::changed, this, &QgsModelGraphicsScene::componentChanged );
253 connect( item, &QgsModelComponentGraphicItem::aboutToChange, this, &QgsModelGraphicsScene::componentAboutToChange );
254
255 // if output added not at the same time as algorithm then it does not have
256 // valid position and will be placed at (0,0). We need to calculate better position.
257 // See https://github.com/qgis/QGIS/issues/48132.
258 QPointF pos = outputIt.value().position();
259 if ( pos.isNull() )
260 {
261 pos = algItem->position() + QPointF( outputOffsetX, outputOffsetY );
262 outputOffsetY += 1.5 * outputIt.value().size().height();
263 }
264 int idx = -1;
265 int i = 0;
266 // find the actual index of the linked output from the child algorithm it comes from
267 if ( it.value().algorithm() )
268 {
269 const QgsProcessingOutputDefinitions sourceChildAlgOutputs = it.value().algorithm()->outputDefinitions();
270 for ( const QgsProcessingOutputDefinition *childAlgOutput : sourceChildAlgOutputs )
271 {
272 if ( childAlgOutput->name() == outputIt.value().childOutputName() )
273 {
274 idx = i;
275 break;
276 }
277 i++;
278 }
279 }
280
281 item->setPos( pos );
282 item->component()->setPosition( pos );
283 outputItems.insert( outputIt.key(), item );
284 addItem( new QgsModelArrowItem( mChildAlgorithmItems[it.value().childId()], Qt::BottomEdge, idx, QgsModelArrowItem::Marker::Circle, item, QgsModelArrowItem::Marker::Circle ) );
285
286 addCommentItemForComponent( model, outputIt.value(), item );
287 }
288 mOutputItems.insert( it.value().childId(), outputItems );
289 }
290}
291
292QList<QgsModelComponentGraphicItem *> QgsModelGraphicsScene::selectedComponentItems()
293{
294 QList<QgsModelComponentGraphicItem *> componentItemList;
295
296 const QList<QGraphicsItem *> graphicsItemList = selectedItems();
297 for ( QGraphicsItem *item : graphicsItemList )
298 {
299 if ( QgsModelComponentGraphicItem *componentItem = dynamic_cast<QgsModelComponentGraphicItem *>( item ) )
300 {
301 componentItemList.push_back( componentItem );
302 }
303 }
304
305 return componentItemList;
306}
307
308QgsModelComponentGraphicItem *QgsModelGraphicsScene::componentItemAt( QPointF position ) const
309{
310 //get a list of items which intersect the specified position, in descending z order
311 const QList<QGraphicsItem *> itemList = items( position, Qt::IntersectsItemShape, Qt::DescendingOrder );
312
313 for ( QGraphicsItem *graphicsItem : itemList )
314 {
315 if ( QgsModelComponentGraphicItem *componentItem = dynamic_cast<QgsModelComponentGraphicItem *>( graphicsItem ) )
316 {
317 return componentItem;
318 }
319 }
320 return nullptr;
321}
322
323QgsModelComponentGraphicItem *QgsModelGraphicsScene::groupBoxItem( const QString &uuid )
324{
325 return mGroupBoxItems.value( uuid );
326}
327
328void QgsModelGraphicsScene::selectAll()
329{
330 //select all items in scene
331 QgsModelComponentGraphicItem *focusedItem = nullptr;
332 const QList<QGraphicsItem *> itemList = items();
333 for ( QGraphicsItem *graphicsItem : itemList )
334 {
335 if ( QgsModelComponentGraphicItem *componentItem = dynamic_cast<QgsModelComponentGraphicItem *>( graphicsItem ) )
336 {
337 componentItem->setSelected( true );
338 if ( !focusedItem )
339 focusedItem = componentItem;
340 }
341 }
342 emit selectedItemChanged( focusedItem );
343}
344
345void QgsModelGraphicsScene::deselectAll()
346{
347 //we can't use QGraphicsScene::clearSelection, as that emits no signals
348 //and we don't know which items are being deselected
349 //instead, do the clear selection manually...
350 const QList<QGraphicsItem *> selectedItemList = selectedItems();
351 for ( QGraphicsItem *item : selectedItemList )
352 {
353 if ( QgsModelComponentGraphicItem *componentItem = dynamic_cast<QgsModelComponentGraphicItem *>( item ) )
354 {
355 componentItem->setSelected( false );
356 }
357 }
358 emit selectedItemChanged( nullptr );
359}
360
361void QgsModelGraphicsScene::setSelectedItem( QgsModelComponentGraphicItem *item )
362{
363 whileBlocking( this )->deselectAll();
364 if ( item )
365 {
366 item->setSelected( true );
367 }
368 emit selectedItemChanged( item );
369}
370
371void QgsModelGraphicsScene::setLastRunResult( const QgsProcessingModelResult &result )
372{
373 mLastResult = result;
374
375 const auto childResults = mLastResult.childResults();
376 for ( auto it = childResults.constBegin(); it != childResults.constEnd(); ++it )
377 {
378 if ( QgsModelChildAlgorithmGraphicItem *item = mChildAlgorithmItems.value( it.key() ) )
379 {
380 item->setResults( it.value() );
381 }
382 }
383}
384
385QList<QgsModelGraphicsScene::LinkSource> QgsModelGraphicsScene::linkSourcesForParameterValue( QgsProcessingModelAlgorithm *model, const QVariant &value, const QString &childId, QgsProcessingContext &context ) const
386{
387 QList<QgsModelGraphicsScene::LinkSource> res;
388 if ( value.userType() == QMetaType::Type::QVariantList )
389 {
390 const QVariantList list = value.toList();
391 for ( const QVariant &v : list )
392 res.append( linkSourcesForParameterValue( model, v, childId, context ) );
393 }
394 else if ( value.userType() == QMetaType::Type::QStringList )
395 {
396 const QStringList list = value.toStringList();
397 for ( const QString &v : list )
398 res.append( linkSourcesForParameterValue( model, v, childId, context ) );
399 }
400 else if ( value.userType() == QMetaType::type( "QgsProcessingModelChildParameterSource" ) )
401 {
402 const QgsProcessingModelChildParameterSource source = value.value< QgsProcessingModelChildParameterSource >();
403 switch ( source.source() )
404 {
406 {
407 LinkSource l;
408 l.item = mParameterItems.value( source.parameterName() );
409 res.append( l );
410 break;
411 }
413 {
414 if ( !model->childAlgorithm( source.outputChildId() ).algorithm() )
415 break;
416
417 const QgsProcessingOutputDefinitions outputs = model->childAlgorithm( source.outputChildId() ).algorithm()->outputDefinitions();
418 int i = 0;
419 for ( const QgsProcessingOutputDefinition *output : outputs )
420 {
421 if ( output->name() == source.outputName() )
422 break;
423 i++;
424 }
425 if ( mChildAlgorithmItems.contains( source.outputChildId() ) )
426 {
427 LinkSource l;
428 l.item = mChildAlgorithmItems.value( source.outputChildId() );
429 l.edge = Qt::BottomEdge;
430
431 // do sanity check of linked index
432 if ( i >= model->childAlgorithm( source.outputChildId() ).algorithm()->outputDefinitions().length() )
433 {
434 QString short_message = tr( "Check output links for alg: %1" ).arg( model->childAlgorithm( source.outputChildId() ).algorithm()->name() );
435 QString long_message = tr( "Cannot link output for alg: %1" ).arg( model->childAlgorithm( source.outputChildId() ).algorithm()->name() );
436 QString title( tr( "Algorithm link error" ) );
437 if ( messageBar() )
438 showWarning( const_cast<QString &>( short_message ), const_cast<QString &>( title ), const_cast<QString &>( long_message ) );
439 else
440 QgsMessageLog::logMessage( long_message, "QgsModelGraphicsScene", Qgis::MessageLevel::Warning, true );
441 break;
442 }
443
444 l.linkIndex = i;
445 res.append( l );
446 }
447
448 break;
449 }
450
452 {
453 const QMap<QString, QgsProcessingModelAlgorithm::VariableDefinition> variables = model->variablesForChildAlgorithm( childId, &context );
454 const QgsExpression exp( source.expression() );
455 const QSet<QString> vars = exp.referencedVariables();
456 for ( const QString &v : vars )
457 {
458 if ( variables.contains( v ) )
459 {
460 res.append( linkSourcesForParameterValue( model, QVariant::fromValue( variables.value( v ).source ), childId, context ) );
461 }
462 }
463 break;
464 }
465
469 break;
470 }
471 }
472 return res;
473}
474
475void QgsModelGraphicsScene::addCommentItemForComponent( QgsProcessingModelAlgorithm *model, const QgsProcessingModelComponent &component, QgsModelComponentGraphicItem *parentItem )
476{
477 if ( mFlags & FlagHideComments || !component.comment() || component.comment()->description().isEmpty() )
478 return;
479
480 QgsModelComponentGraphicItem *commentItem = createCommentGraphicItem( model, component.comment()->clone(), parentItem );
481 commentItem->setPos( component.comment()->position().x(), component.comment()->position().y() );
482 addItem( commentItem );
483 connect( commentItem, &QgsModelComponentGraphicItem::requestModelRepaint, this, &QgsModelGraphicsScene::rebuildRequired );
484 connect( commentItem, &QgsModelComponentGraphicItem::changed, this, &QgsModelGraphicsScene::componentChanged );
485 connect( commentItem, &QgsModelComponentGraphicItem::aboutToChange, this, &QgsModelGraphicsScene::componentAboutToChange );
486
487 std::unique_ptr< QgsModelArrowItem > arrow = std::make_unique< QgsModelArrowItem >( parentItem, QgsModelArrowItem::Circle, commentItem, QgsModelArrowItem::Circle );
488 arrow->setPenStyle( Qt::DotLine );
489 addItem( arrow.release() );
490}
491
492QgsMessageBar *QgsModelGraphicsScene::messageBar() const
493{
494 return mMessageBar;
495}
496
497void QgsModelGraphicsScene::setMessageBar( QgsMessageBar *messageBar )
498{
499 mMessageBar = messageBar;
500}
501
502void QgsModelGraphicsScene::showWarning( const QString &shortMessage, const QString &title, const QString &longMessage, Qgis::MessageLevel level ) const
503{
504 QgsMessageBarItem *messageWidget = QgsMessageBar::createMessage( QString(), shortMessage );
505 QPushButton *detailsButton = new QPushButton( tr( "Details" ) );
506 connect( detailsButton, &QPushButton::clicked, detailsButton, [ = ]
507 {
508 QgsMessageViewer *dialog = new QgsMessageViewer( detailsButton );
509 dialog->setTitle( title );
510 dialog->setMessage( longMessage, QgsMessageOutput::MessageHtml );
511 dialog->showMessage();
512 } );
513 messageWidget->layout()->addWidget( detailsButton );
514 mMessageBar->clearWidgets();
515 mMessageBar->pushWidget( messageWidget, level, 0 );
516}
517
MessageLevel
Level for messages This will be used both for message log and message bar in application.
Definition qgis.h:99
@ Warning
Warning message.
Definition qgis.h:101
@ ExpressionText
Parameter value is taken from a text with expressions, evaluated just before the algorithm runs.
@ ModelOutput
Parameter value is linked to an output parameter for the model.
@ ChildOutput
Parameter value is taken from an output generated by a child algorithm.
@ ModelParameter
Parameter value is taken from a parent model parameter.
@ StaticValue
Parameter value is a static value.
@ Expression
Parameter value is taken from an expression, evaluated just before the algorithm runs.
@ Hidden
Parameter is hidden and should not be shown to users.
Class for parsing and evaluation of expressions (formerly called "search strings").
Represents an item shown within a QgsMessageBar widget.
A bar for displaying non-blocking messages to the user.
static QgsMessageBarItem * createMessage(const QString &text, QWidget *parent=nullptr)
Creates message bar item widget containing a message text to be displayed on the bar.
static void logMessage(const QString &message, const QString &tag=QString(), Qgis::MessageLevel level=Qgis::MessageLevel::Warning, bool notifyUser=true)
Adds a message to the log instance (and creates it if necessary).
A generic message view for displaying QGIS messages.
void setTitle(const QString &title) override
Sets title for the messages.
void setMessage(const QString &message, MessageType msgType) override
Sets message, it won't be displayed until.
void showMessage(bool blocking=true) override
display the message to the user and deletes itself
QgsProcessingOutputDefinitions outputDefinitions() const
Returns an ordered list of output definitions utilized by the algorithm.
Contains information about the context in which a processing algorithm is executed.
Encapsulates the results of running a Processing model.
QMap< QString, QgsProcessingModelChildAlgorithmResult > childResults() const
Returns the map of child algorithm results.
Base class for the definition of processing outputs.
Base class for the definition of processing parameters.
virtual QStringList dependsOnOtherParameters() const
Returns a list of other parameter names on which this parameter is dependent (e.g.
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
QgsSignalBlocker< Object > whileBlocking(Object *object)
Temporarily blocks signals from a QObject while calling a single method from the object.
Definition qgis.h:5349
QList< const QgsProcessingOutputDefinition * > QgsProcessingOutputDefinitions
List of processing parameters.
QList< const QgsProcessingParameterDefinition * > QgsProcessingParameterDefinitions
List of processing parameters.