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