QGIS API Documentation 3.41.0-Master (45a0abf3bec)
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 {
151 emit runFromChild( childId );
152 } );
153 connect( item, &QgsModelChildAlgorithmGraphicItem::runSelected, this, &QgsModelGraphicsScene::runSelected );
154 connect( item, &QgsModelChildAlgorithmGraphicItem::showPreviousResults, this, [this, childId]
155 {
156 emit showChildAlgorithmOutputs( childId );
157 } );
158 connect( item, &QgsModelChildAlgorithmGraphicItem::showLog, this, [this, childId]
159 {
160 emit showChildAlgorithmLog( childId );
161 } );
162
163 addCommentItemForComponent( model, it.value(), item );
164 }
165
166 // arrows linking child algorithms
167 for ( auto it = childAlgs.constBegin(); it != childAlgs.constEnd(); ++it )
168 {
169 int topIdx = 0;
170 int bottomIdx = 0;
171 if ( !it.value().algorithm() )
172 continue;
173
174 const QgsProcessingParameterDefinitions parameters = it.value().algorithm()->parameterDefinitions();
175 for ( const QgsProcessingParameterDefinition *parameter : parameters )
176 {
177 if ( !( parameter->flags() & Qgis::ProcessingParameterFlag::Hidden ) )
178 {
179 QList< QgsProcessingModelChildParameterSource > sources;
180 if ( it.value().parameterSources().contains( parameter->name() ) )
181 sources = it.value().parameterSources()[parameter->name()];
182 for ( const QgsProcessingModelChildParameterSource &source : std::as_const( sources ) )
183 {
184 const QList< LinkSource > sourceItems = linkSourcesForParameterValue( model, QVariant::fromValue( source ), it.value().childId(), context );
185 for ( const LinkSource &link : sourceItems )
186 {
187 if ( !link.item )
188 continue;
189 QgsModelArrowItem *arrow = nullptr;
190 if ( link.linkIndex == -1 )
191 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 );
192 else
193 arrow = new QgsModelArrowItem( link.item, link.edge, link.linkIndex, true, QgsModelArrowItem::Marker::Circle,
194 mChildAlgorithmItems.value( it.value().childId() ),
195 parameter->isDestination() ? Qt::BottomEdge : Qt::TopEdge,
196 parameter->isDestination() ? bottomIdx : topIdx,
197 true,
198 QgsModelArrowItem::Marker::Circle );
199 addItem( arrow );
200 }
201 }
202 if ( parameter->isDestination() )
203 bottomIdx++;
204 else
205 topIdx++;
206 }
207 }
208 const QList< QgsProcessingModelChildDependency > dependencies = it.value().dependencies();
209 for ( const QgsProcessingModelChildDependency &depend : dependencies )
210 {
211 if ( depend.conditionalBranch.isEmpty() || !model->childAlgorithm( depend.childId ).algorithm() )
212 {
213 addItem( new QgsModelArrowItem( mChildAlgorithmItems.value( depend.childId ), QgsModelArrowItem::Marker::Circle, mChildAlgorithmItems.value( it.value().childId() ), QgsModelArrowItem::Marker::ArrowHead ) );
214 }
215 else
216 {
217 // find branch link point
218 const QgsProcessingOutputDefinitions outputs = model->childAlgorithm( depend.childId ).algorithm()->outputDefinitions();
219 int i = 0;
220 bool found = false;
221 for ( const QgsProcessingOutputDefinition *output : outputs )
222 {
223 if ( output->name() == depend.conditionalBranch )
224 {
225 found = true;
226 break;
227 }
228 i++;
229 }
230 if ( found )
231 addItem( new QgsModelArrowItem( mChildAlgorithmItems.value( depend.childId ), Qt::BottomEdge, i, QgsModelArrowItem::Marker::Circle, mChildAlgorithmItems.value( it.value().childId() ), QgsModelArrowItem::Marker::ArrowHead ) );
232 }
233 }
234 }
235
236 // and finally the model outputs
237 for ( auto it = childAlgs.constBegin(); it != childAlgs.constEnd(); ++it )
238 {
239 const QMap<QString, QgsProcessingModelOutput> outputs = it.value().modelOutputs();
240 QMap< QString, QgsModelComponentGraphicItem * > outputItems;
241
242 // offsets from algorithm item needed to correctly place output items
243 // which does not have valid position assigned (https://github.com/qgis/QGIS/issues/48132)
244 QgsProcessingModelComponent *algItem = mChildAlgorithmItems[it.value().childId()]->component();
245 const double outputOffsetX = algItem->size().width();
246 double outputOffsetY = 1.5 * algItem->size().height();
247
248 for ( auto outputIt = outputs.constBegin(); outputIt != outputs.constEnd(); ++outputIt )
249 {
250 QgsModelComponentGraphicItem *item = createOutputGraphicItem( model, outputIt.value().clone() );
251 addItem( item );
252 connect( item, &QgsModelComponentGraphicItem::requestModelRepaint, this, &QgsModelGraphicsScene::rebuildRequired );
253 connect( item, &QgsModelComponentGraphicItem::changed, this, &QgsModelGraphicsScene::componentChanged );
254 connect( item, &QgsModelComponentGraphicItem::aboutToChange, this, &QgsModelGraphicsScene::componentAboutToChange );
255
256 // if output added not at the same time as algorithm then it does not have
257 // valid position and will be placed at (0,0). We need to calculate better position.
258 // See https://github.com/qgis/QGIS/issues/48132.
259 QPointF pos = outputIt.value().position();
260 if ( pos.isNull() )
261 {
262 pos = algItem->position() + QPointF( outputOffsetX, outputOffsetY );
263 outputOffsetY += 1.5 * outputIt.value().size().height();
264 }
265 int idx = -1;
266 int i = 0;
267 // find the actual index of the linked output from the child algorithm it comes from
268 if ( it.value().algorithm() )
269 {
270 const QgsProcessingOutputDefinitions sourceChildAlgOutputs = it.value().algorithm()->outputDefinitions();
271 for ( const QgsProcessingOutputDefinition *childAlgOutput : sourceChildAlgOutputs )
272 {
273 if ( childAlgOutput->name() == outputIt.value().childOutputName() )
274 {
275 idx = i;
276 break;
277 }
278 i++;
279 }
280 }
281
282 item->setPos( pos );
283 item->component()->setPosition( pos );
284 outputItems.insert( outputIt.key(), item );
285 addItem( new QgsModelArrowItem( mChildAlgorithmItems[it.value().childId()], Qt::BottomEdge, idx, QgsModelArrowItem::Marker::Circle, item, QgsModelArrowItem::Marker::Circle ) );
286
287 addCommentItemForComponent( model, outputIt.value(), item );
288 }
289 mOutputItems.insert( it.value().childId(), outputItems );
290 }
291}
292
293QList<QgsModelComponentGraphicItem *> QgsModelGraphicsScene::selectedComponentItems()
294{
295 QList<QgsModelComponentGraphicItem *> componentItemList;
296
297 const QList<QGraphicsItem *> graphicsItemList = selectedItems();
298 for ( QGraphicsItem *item : graphicsItemList )
299 {
300 if ( QgsModelComponentGraphicItem *componentItem = dynamic_cast<QgsModelComponentGraphicItem *>( item ) )
301 {
302 componentItemList.push_back( componentItem );
303 }
304 }
305
306 return componentItemList;
307}
308
309QgsModelComponentGraphicItem *QgsModelGraphicsScene::componentItemAt( QPointF position ) const
310{
311 //get a list of items which intersect the specified position, in descending z order
312 const QList<QGraphicsItem *> itemList = items( position, Qt::IntersectsItemShape, Qt::DescendingOrder );
313
314 for ( QGraphicsItem *graphicsItem : itemList )
315 {
316 if ( QgsModelComponentGraphicItem *componentItem = dynamic_cast<QgsModelComponentGraphicItem *>( graphicsItem ) )
317 {
318 return componentItem;
319 }
320 }
321 return nullptr;
322}
323
324QgsModelComponentGraphicItem *QgsModelGraphicsScene::groupBoxItem( const QString &uuid )
325{
326 return mGroupBoxItems.value( uuid );
327}
328
329void QgsModelGraphicsScene::selectAll()
330{
331 //select all items in scene
332 QgsModelComponentGraphicItem *focusedItem = nullptr;
333 const QList<QGraphicsItem *> itemList = items();
334 for ( QGraphicsItem *graphicsItem : itemList )
335 {
336 if ( QgsModelComponentGraphicItem *componentItem = dynamic_cast<QgsModelComponentGraphicItem *>( graphicsItem ) )
337 {
338 componentItem->setSelected( true );
339 if ( !focusedItem )
340 focusedItem = componentItem;
341 }
342 }
343 emit selectedItemChanged( focusedItem );
344}
345
346void QgsModelGraphicsScene::deselectAll()
347{
348 //we can't use QGraphicsScene::clearSelection, as that emits no signals
349 //and we don't know which items are being deselected
350 //instead, do the clear selection manually...
351 const QList<QGraphicsItem *> selectedItemList = selectedItems();
352 for ( QGraphicsItem *item : selectedItemList )
353 {
354 if ( QgsModelComponentGraphicItem *componentItem = dynamic_cast<QgsModelComponentGraphicItem *>( item ) )
355 {
356 componentItem->setSelected( false );
357 }
358 }
359 emit selectedItemChanged( nullptr );
360}
361
362void QgsModelGraphicsScene::setSelectedItem( QgsModelComponentGraphicItem *item )
363{
364 whileBlocking( this )->deselectAll();
365 if ( item )
366 {
367 item->setSelected( true );
368 }
369 emit selectedItemChanged( item );
370}
371
372void QgsModelGraphicsScene::setLastRunResult( const QgsProcessingModelResult &result )
373{
374 mLastResult = result;
375
376 const auto childResults = mLastResult.childResults();
377 for ( auto it = childResults.constBegin(); it != childResults.constEnd(); ++it )
378 {
379 if ( QgsModelChildAlgorithmGraphicItem *item = mChildAlgorithmItems.value( it.key() ) )
380 {
381 item->setResults( it.value() );
382 }
383 }
384}
385
386QList<QgsModelGraphicsScene::LinkSource> QgsModelGraphicsScene::linkSourcesForParameterValue( QgsProcessingModelAlgorithm *model, const QVariant &value, const QString &childId, QgsProcessingContext &context ) const
387{
388 QList<QgsModelGraphicsScene::LinkSource> res;
389 if ( value.userType() == QMetaType::Type::QVariantList )
390 {
391 const QVariantList list = value.toList();
392 for ( const QVariant &v : list )
393 res.append( linkSourcesForParameterValue( model, v, childId, context ) );
394 }
395 else if ( value.userType() == QMetaType::Type::QStringList )
396 {
397 const QStringList list = value.toStringList();
398 for ( const QString &v : list )
399 res.append( linkSourcesForParameterValue( model, v, childId, context ) );
400 }
401 else if ( value.userType() == qMetaTypeId<QgsProcessingModelChildParameterSource>() )
402 {
403 const QgsProcessingModelChildParameterSource source = value.value< QgsProcessingModelChildParameterSource >();
404 switch ( source.source() )
405 {
407 {
408 LinkSource l;
409 l.item = mParameterItems.value( source.parameterName() );
410 res.append( l );
411 break;
412 }
414 {
415 if ( !model->childAlgorithm( source.outputChildId() ).algorithm() )
416 break;
417
418 const QgsProcessingOutputDefinitions outputs = model->childAlgorithm( source.outputChildId() ).algorithm()->outputDefinitions();
419 int i = 0;
420 for ( const QgsProcessingOutputDefinition *output : outputs )
421 {
422 if ( output->name() == source.outputName() )
423 break;
424 i++;
425 }
426 if ( mChildAlgorithmItems.contains( source.outputChildId() ) )
427 {
428 LinkSource l;
429 l.item = mChildAlgorithmItems.value( source.outputChildId() );
430 l.edge = Qt::BottomEdge;
431
432 // do sanity check of linked index
433 if ( i >= model->childAlgorithm( source.outputChildId() ).algorithm()->outputDefinitions().length() )
434 {
435 QString short_message = tr( "Check output links for alg: %1" ).arg( model->childAlgorithm( source.outputChildId() ).algorithm()->name() );
436 QString long_message = tr( "Cannot link output for alg: %1" ).arg( model->childAlgorithm( source.outputChildId() ).algorithm()->name() );
437 QString title( tr( "Algorithm link error" ) );
438 if ( messageBar() )
439 showWarning( const_cast<QString &>( short_message ), const_cast<QString &>( title ), const_cast<QString &>( long_message ) );
440 else
441 QgsMessageLog::logMessage( long_message, "QgsModelGraphicsScene", Qgis::MessageLevel::Warning, true );
442 break;
443 }
444
445 l.linkIndex = i;
446 res.append( l );
447 }
448
449 break;
450 }
451
453 {
454 const QMap<QString, QgsProcessingModelAlgorithm::VariableDefinition> variables = model->variablesForChildAlgorithm( childId, &context );
455 const QgsExpression exp( source.expression() );
456 const QSet<QString> vars = exp.referencedVariables();
457 for ( const QString &v : vars )
458 {
459 if ( variables.contains( v ) )
460 {
461 res.append( linkSourcesForParameterValue( model, QVariant::fromValue( variables.value( v ).source ), childId, context ) );
462 }
463 }
464 break;
465 }
466
470 break;
471 }
472 }
473 return res;
474}
475
476void QgsModelGraphicsScene::addCommentItemForComponent( QgsProcessingModelAlgorithm *model, const QgsProcessingModelComponent &component, QgsModelComponentGraphicItem *parentItem )
477{
478 if ( mFlags & FlagHideComments || !component.comment() || component.comment()->description().isEmpty() )
479 return;
480
481 QgsModelComponentGraphicItem *commentItem = createCommentGraphicItem( model, component.comment()->clone(), parentItem );
482 commentItem->setPos( component.comment()->position().x(), component.comment()->position().y() );
483 addItem( commentItem );
484 connect( commentItem, &QgsModelComponentGraphicItem::requestModelRepaint, this, &QgsModelGraphicsScene::rebuildRequired );
485 connect( commentItem, &QgsModelComponentGraphicItem::changed, this, &QgsModelGraphicsScene::componentChanged );
486 connect( commentItem, &QgsModelComponentGraphicItem::aboutToChange, this, &QgsModelGraphicsScene::componentAboutToChange );
487
488 std::unique_ptr< QgsModelArrowItem > arrow = std::make_unique< QgsModelArrowItem >( parentItem, QgsModelArrowItem::Circle, commentItem, QgsModelArrowItem::Circle );
489 arrow->setPenStyle( Qt::DotLine );
490 addItem( arrow.release() );
491}
492
493QgsMessageBar *QgsModelGraphicsScene::messageBar() const
494{
495 return mMessageBar;
496}
497
498void QgsModelGraphicsScene::setMessageBar( QgsMessageBar *messageBar )
499{
500 mMessageBar = messageBar;
501}
502
503void QgsModelGraphicsScene::showWarning( const QString &shortMessage, const QString &title, const QString &longMessage, Qgis::MessageLevel level ) const
504{
505 QgsMessageBarItem *messageWidget = QgsMessageBar::createMessage( QString(), shortMessage );
506 QPushButton *detailsButton = new QPushButton( tr( "Details" ) );
507 connect( detailsButton, &QPushButton::clicked, detailsButton, [ = ]
508 {
509 QgsMessageViewer *dialog = new QgsMessageViewer( detailsButton );
510 dialog->setTitle( title );
511 dialog->setMessage( longMessage, QgsMessageOutput::MessageHtml );
512 dialog->showMessage();
513 } );
514 messageWidget->layout()->addWidget( detailsButton );
515 mMessageBar->clearWidgets();
516 mMessageBar->pushWidget( messageWidget, level, 0 );
517}
518
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:5862
QList< const QgsProcessingOutputDefinition * > QgsProcessingOutputDefinitions
List of processing parameters.
QList< const QgsProcessingParameterDefinition * > QgsProcessingParameterDefinitions
List of processing parameters.