31#include <QGraphicsSceneMouseEvent>
32#include <QGraphicsTextItem>
36#include "moc_qgsmodelgraphicsscene.cpp"
38using namespace Qt::StringLiterals;
42QgsModelGraphicsScene::QgsModelGraphicsScene( QObject *parent )
43 : QGraphicsScene( parent )
45 setItemIndexMethod( QGraphicsScene::NoIndex );
47 connect(
this, &QgsModelGraphicsScene::componentChanged,
this, &QgsModelGraphicsScene::updateBounds );
50QgsProcessingModelAlgorithm *QgsModelGraphicsScene::model()
55void QgsModelGraphicsScene::setModel( QgsProcessingModelAlgorithm *model )
60void QgsModelGraphicsScene::setFlag( QgsModelGraphicsScene::Flag flag,
bool on )
68void QgsModelGraphicsScene::mousePressEvent( QGraphicsSceneMouseEvent *event )
70 if ( event->button() != Qt::LeftButton )
72 QGraphicsScene::mousePressEvent( event );
75void QgsModelGraphicsScene::updateBounds()
81 const QList<QGraphicsItem *> constItems = items();
82 for ( QGraphicsItem *item : constItems )
84 QgsModelComponentGraphicItem *componentItem =
dynamic_cast<QgsModelComponentGraphicItem *
>( item );
86 bounds = bounds.united( componentItem->sceneBoundingRect() );
89 if ( bounds.isValid() )
92 bounds.adjust( -SCENE_COMPONENT_MARGIN, -SCENE_COMPONENT_MARGIN, SCENE_COMPONENT_MARGIN, SCENE_COMPONENT_MARGIN );
93 bounds.setLeft( std::floor( bounds.left() ) );
94 bounds.setTop( std::floor( bounds.top() ) );
95 bounds.setRight( std::ceil( bounds.right() ) );
96 bounds.setBottom( std::ceil( bounds.bottom() ) );
99 setSceneRect( bounds );
105 if ( QgsModelChildAlgorithmGraphicItem *item = childAlgorithmItem( childId ) )
107 item->setProgress( progress );
112 if ( QgsModelChildAlgorithmGraphicItem *item = childAlgorithmItem( childId ) )
119 if ( QgsModelChildAlgorithmGraphicItem *item = childAlgorithmItem( childId ) )
121 item->setResults( result );
126 if ( QgsModelChildAlgorithmGraphicItem *item = childAlgorithmItem( childId ) )
128 item->setSinkFeatureCount( outputName, featureCount );
133 if ( QgsModelChildAlgorithmGraphicItem *item = childAlgorithmItem( childId ) )
135 item->setSourceFeatureCount( parameterName, featureCount );
140void QgsModelGraphicsScene::flagChildrenAsOutdated(
const QSet<QString> &children )
142 for (
const QString &child : children )
144 if ( QgsModelChildAlgorithmGraphicItem *item = childAlgorithmItem( child ) )
153 mWidgetContextGenerator = generator;
156QgsModelComponentGraphicItem *QgsModelGraphicsScene::createParameterGraphicItem( QgsProcessingModelAlgorithm *model, QgsProcessingModelParameter *param )
const
158 return new QgsModelParameterGraphicItem( param, model,
nullptr );
161QgsModelChildAlgorithmGraphicItem *QgsModelGraphicsScene::createChildAlgGraphicItem( QgsProcessingModelAlgorithm *model, QgsProcessingModelChildAlgorithm *child )
const
163 return new QgsModelChildAlgorithmGraphicItem( child, model,
nullptr );
166QgsModelComponentGraphicItem *QgsModelGraphicsScene::createOutputGraphicItem( QgsProcessingModelAlgorithm *model, QgsProcessingModelOutput *output )
const
168 return new QgsModelOutputGraphicItem( output, model,
nullptr );
171QgsModelComponentGraphicItem *QgsModelGraphicsScene::createCommentGraphicItem( QgsProcessingModelAlgorithm *model, QgsProcessingModelComment *comment, QgsModelComponentGraphicItem *parentItem )
const
173 return new QgsModelCommentGraphicItem( comment, parentItem, model,
nullptr );
176QgsModelComponentGraphicItem *QgsModelGraphicsScene::createGroupBoxGraphicItem( QgsProcessingModelAlgorithm *model, QgsProcessingModelGroupBox *box )
const
178 return new QgsModelGroupBoxGraphicItem( box, model,
nullptr );
181void QgsModelGraphicsScene::createItems( QgsProcessingModelAlgorithm *model,
QgsProcessingContext &context )
184 const QList<QgsProcessingModelGroupBox> boxes = model->groupBoxes();
185 mGroupBoxItems.clear();
186 for (
const QgsProcessingModelGroupBox &box : boxes )
188 QgsModelComponentGraphicItem *item = createGroupBoxGraphicItem( model, box.clone() );
189 item->registerWidgetContextGenerator( mWidgetContextGenerator );
191 item->setPos( box.position().x(), box.position().y() );
192 mGroupBoxItems.insert( box.uuid(), item );
193 connect( item, &QgsModelComponentGraphicItem::requestModelRepaint,
this, &QgsModelGraphicsScene::rebuildRequired );
194 connect( item, &QgsModelComponentGraphicItem::changed,
this, &QgsModelGraphicsScene::componentChanged );
195 connect( item, &QgsModelComponentGraphicItem::aboutToChange,
this, &QgsModelGraphicsScene::componentAboutToChange );
199 const QMap<QString, QgsProcessingModelParameter> params = model->parameterComponents();
200 for (
auto it = params.constBegin(); it != params.constEnd(); ++it )
202 QgsModelComponentGraphicItem *item = createParameterGraphicItem( model, it.value().clone() );
203 item->registerWidgetContextGenerator( mWidgetContextGenerator );
205 item->setPos( it.value().position().x(), it.value().position().y() );
206 mParameterItems.insert( it.value().parameterName(), item );
207 connect( item, &QgsModelComponentGraphicItem::requestModelRepaint,
this, &QgsModelGraphicsScene::rebuildRequired );
208 connect( item, &QgsModelComponentGraphicItem::changed,
this, &QgsModelGraphicsScene::componentChanged );
209 connect( item, &QgsModelComponentGraphicItem::aboutToChange,
this, &QgsModelGraphicsScene::componentAboutToChange );
211 addCommentItemForComponent( model, it.value(), item );
215 for (
auto it = params.constBegin(); it != params.constEnd(); ++it )
219 for (
const QString &otherName : parameterLinks )
221 if ( mParameterItems.contains( it.key() ) && mParameterItems.contains( otherName ) )
223 auto arrow = std::make_unique<QgsModelArrowItem>( mParameterItems.value( otherName ), QgsModelArrowItem::Marker::Circle, mParameterItems.value( it.key() ), QgsModelArrowItem::Marker::ArrowHead );
224 arrow->setPenStyle( Qt::DotLine );
225 addItem( arrow.release() );
231 const QMap<QString, QgsProcessingModelChildAlgorithm> childAlgs = model->childAlgorithms();
232 for (
auto it = childAlgs.constBegin(); it != childAlgs.constEnd(); ++it )
234 QgsModelChildAlgorithmGraphicItem *item = createChildAlgGraphicItem( model, it.value().clone() );
235 item->registerWidgetContextGenerator( mWidgetContextGenerator );
237 item->setPos( it.value().position().x(), it.value().position().y() );
239 const QString childId = it.value().childId();
240 mChildAlgorithmItems.insert( childId, item );
241 connect( item, &QgsModelComponentGraphicItem::requestModelRepaint,
this, &QgsModelGraphicsScene::rebuildRequired );
242 connect( item, &QgsModelComponentGraphicItem::changed,
this, &QgsModelGraphicsScene::componentChanged );
243 connect( item, &QgsModelComponentGraphicItem::aboutToChange,
this, &QgsModelGraphicsScene::componentAboutToChange );
244 connect( item, &QgsModelChildAlgorithmGraphicItem::runFromHere,
this, [
this, childId] { emit runFromChild( childId ); } );
245 connect( item, &QgsModelChildAlgorithmGraphicItem::runSelected,
this, &QgsModelGraphicsScene::runSelected );
246 connect( item, &QgsModelChildAlgorithmGraphicItem::showPreviousResults,
this, [
this, childId] { emit showChildAlgorithmOutputs( childId ); } );
247 connect( item, &QgsModelChildAlgorithmGraphicItem::showLog,
this, [
this, childId] { emit showChildAlgorithmLog( childId ); } );
249 addCommentItemForComponent( model, it.value(), item );
253 for (
auto it = childAlgs.constBegin(); it != childAlgs.constEnd(); ++it )
257 if ( !it.value().algorithm() )
265 QList<QgsProcessingModelChildParameterSource> sources;
266 if ( it.value().parameterSources().contains( parameter->name() ) )
267 sources = it.value().parameterSources()[parameter->name()];
268 for (
const QgsProcessingModelChildParameterSource &source : std::as_const( sources ) )
270 const QList<LinkSource> sourceItems = linkSourcesForParameterValue( model, QVariant::fromValue( source ), it.value().childId(), context );
271 for (
const LinkSource &link : sourceItems )
275 QgsModelArrowItem *arrow =
nullptr;
276 if ( link.linkIndex == -1 )
278 arrow =
new QgsModelArrowItem(
280 QgsModelArrowItem::Marker::NoMarker,
281 mChildAlgorithmItems.value( it.value().childId() ),
282 parameter->isDestination() ? Qt::BottomEdge : Qt::TopEdge,
283 parameter->isDestination() ? bottomIdx : topIdx,
284 QgsModelArrowItem::Marker::Circle
289 arrow =
new QgsModelArrowItem(
294 QgsModelArrowItem::Marker::NoMarker,
295 mChildAlgorithmItems.value( it.value().childId() ),
296 parameter->isDestination() ? Qt::BottomEdge : Qt::TopEdge,
297 parameter->isDestination() ? bottomIdx : topIdx,
299 QgsModelArrowItem::Marker::NoMarker
304 const QString layerId = mLastResult.childResults().value( it.value().childId() ).inputs().value( parameter->name() ).toString();
305 addFeatureCountItemForArrow( arrow, layerId );
308 if ( parameter->isDestination() )
314 const QList<QgsProcessingModelChildDependency> dependencies = it.value().dependencies();
315 for (
const QgsProcessingModelChildDependency &depend : dependencies )
317 if ( depend.conditionalBranch.isEmpty() || !model->childAlgorithm( depend.childId ).algorithm() )
320 new QgsModelArrowItem( mChildAlgorithmItems.value( depend.childId ), QgsModelArrowItem::Marker::Circle, mChildAlgorithmItems.value( it.value().childId() ), QgsModelArrowItem::Marker::ArrowHead )
331 if ( output->name() == depend.conditionalBranch )
340 new QgsModelArrowItem( mChildAlgorithmItems.value( depend.childId ), Qt::BottomEdge, i, QgsModelArrowItem::Marker::Circle, mChildAlgorithmItems.value( it.value().childId() ), QgsModelArrowItem::Marker::ArrowHead )
347 for (
auto it = childAlgs.constBegin(); it != childAlgs.constEnd(); ++it )
349 const QMap<QString, QgsProcessingModelOutput> outputs = it.value().modelOutputs();
350 QMap<QString, QgsModelComponentGraphicItem *> outputItems;
354 QgsProcessingModelComponent *algItem = mChildAlgorithmItems[it.value().childId()]->component();
355 const double outputOffsetX = algItem->size().width();
356 double outputOffsetY = 1.5 * algItem->size().height();
358 for (
auto outputIt = outputs.constBegin(); outputIt != outputs.constEnd(); ++outputIt )
360 QgsModelComponentGraphicItem *item = createOutputGraphicItem( model, outputIt.value().clone() );
361 item->registerWidgetContextGenerator( mWidgetContextGenerator );
363 connect( item, &QgsModelComponentGraphicItem::requestModelRepaint,
this, &QgsModelGraphicsScene::rebuildRequired );
364 connect( item, &QgsModelComponentGraphicItem::changed,
this, &QgsModelGraphicsScene::componentChanged );
365 connect( item, &QgsModelComponentGraphicItem::aboutToChange,
this, &QgsModelGraphicsScene::componentAboutToChange );
370 QPointF pos = outputIt.value().position();
373 pos = algItem->position() + QPointF( outputOffsetX, outputOffsetY );
374 outputOffsetY += 1.5 * outputIt.value().size().height();
379 if ( it.value().algorithm() )
384 if ( childAlgOutput->name() == outputIt.value().childOutputName() )
394 item->component()->setPosition( pos );
395 outputItems.insert( outputIt.value().childOutputName(), item );
396 QgsModelArrowItem *arrow =
new QgsModelArrowItem( mChildAlgorithmItems[it.value().childId()], Qt::BottomEdge, idx, QgsModelArrowItem::Marker::Circle, item, QgsModelArrowItem::Marker::Circle );
399 QString layerId = mLastResult.childResults().value( it.value().childId() ).outputs().value( outputIt.value().childOutputName() ).toString();
400 addFeatureCountItemForArrow( arrow, layerId );
402 addCommentItemForComponent( model, outputIt.value(), item );
404 mOutputItems.insert( it.value().childId(), outputItems );
408 for (
auto it = childAlgs.constBegin(); it != childAlgs.constEnd(); ++it )
410 const QString childId = it.value().childId();
411 if ( QgsModelChildAlgorithmGraphicItem *item = childAlgorithmItem( it.key() ) )
413 item->setResults( mLastResult.childResults().value( childId ) );
418QList<QgsModelComponentGraphicItem *> QgsModelGraphicsScene::selectedComponentItems()
420 QList<QgsModelComponentGraphicItem *> componentItemList;
422 const QList<QGraphicsItem *> graphicsItemList = selectedItems();
423 for ( QGraphicsItem *item : graphicsItemList )
425 if ( QgsModelComponentGraphicItem *componentItem =
dynamic_cast<QgsModelComponentGraphicItem *
>( item ) )
427 componentItemList.push_back( componentItem );
431 return componentItemList;
434QgsModelComponentGraphicItem *QgsModelGraphicsScene::componentItemAt( QPointF position )
const
437 const QList<QGraphicsItem *> itemList = items( position, Qt::IntersectsItemShape, Qt::DescendingOrder );
439 for ( QGraphicsItem *graphicsItem : itemList )
441 if ( QgsModelComponentGraphicItem *componentItem =
dynamic_cast<QgsModelComponentGraphicItem *
>( graphicsItem ) )
443 return componentItem;
449QgsModelComponentGraphicItem *QgsModelGraphicsScene::groupBoxItem(
const QString &uuid )
451 return mGroupBoxItems.value( uuid );
454QgsModelChildAlgorithmGraphicItem *QgsModelGraphicsScene::childAlgorithmItem(
const QString &childId )
456 return mChildAlgorithmItems.value( childId );
459void QgsModelGraphicsScene::resetChildAlgorithmItems(
const QSet<QString> &childAlgorithmSubset )
461 if ( !childAlgorithmSubset.isEmpty() )
463 for (
const QString &childId : childAlgorithmSubset )
465 if ( QgsModelChildAlgorithmGraphicItem *item = childAlgorithmItem( childId ) )
473 for (
auto it = mChildAlgorithmItems.constBegin(); it != mChildAlgorithmItems.constEnd(); ++it )
480QgsModelComponentGraphicItem *QgsModelGraphicsScene::parameterItem(
const QString &name )
482 return mParameterItems.value( name );
485QgsModelComponentGraphicItem *QgsModelGraphicsScene::outputItem(
const QString &childId,
const QString &childOutputName )
487 auto it = mOutputItems.constFind( childId );
488 if ( it == mOutputItems.constEnd() )
491 auto outputIt = it->constFind( childOutputName );
492 if ( outputIt == it->constEnd() )
495 return outputIt.value();
498void QgsModelGraphicsScene::selectAll()
501 QgsModelComponentGraphicItem *focusedItem =
nullptr;
502 const QList<QGraphicsItem *> itemList = items();
503 for ( QGraphicsItem *graphicsItem : itemList )
505 if ( QgsModelComponentGraphicItem *componentItem =
dynamic_cast<QgsModelComponentGraphicItem *
>( graphicsItem ) )
507 componentItem->setSelected(
true );
509 focusedItem = componentItem;
512 emit selectedItemChanged( focusedItem );
515void QgsModelGraphicsScene::deselectAll()
520 const QList<QGraphicsItem *> selectedItemList = selectedItems();
521 for ( QGraphicsItem *item : selectedItemList )
523 if ( QgsModelComponentGraphicItem *componentItem =
dynamic_cast<QgsModelComponentGraphicItem *
>( item ) )
525 componentItem->setSelected(
false );
528 emit selectedItemChanged(
nullptr );
531void QgsModelGraphicsScene::setSelectedItem( QgsModelComponentGraphicItem *item )
536 item->setSelected(
true );
538 emit selectedItemChanged( item );
543 mLastResult = result;
546 for (
auto it = childResults.constBegin(); it != childResults.constEnd(); ++it )
548 if ( QgsModelChildAlgorithmGraphicItem *item = mChildAlgorithmItems.value( it.key() ) )
550 item->setResults( it.value() );
554 mLastResultCount.clear();
556 for (
auto it = childResults.constBegin(); it != childResults.constEnd(); ++it )
558 QVariantMap inputs = childResults.value( it.key() ).inputs();
559 for (
auto inputIt = inputs.constBegin(); inputIt != inputs.constEnd(); inputIt++ )
563 QgsVectorLayer *vl = qobject_cast<QgsVectorLayer *>( resultMapLayer );
566 mLastResultCount.insert( inputs.value( inputIt.key() ).toString(), vl->
featureCount() );
571 QVariantMap outputs = childResults.value( it.key() ).outputs();
572 for (
auto outputIt = outputs.constBegin(); outputIt != outputs.constEnd(); outputIt++ )
576 QgsVectorLayer *vl = qobject_cast<QgsVectorLayer *>( resultMapLayer );
579 mLastResultCount.insert( outputs.value( outputIt.key() ).toString(), vl->
featureCount() );
585 emit requestRebuildRequired();
588QList<QgsModelGraphicsScene::LinkSource> QgsModelGraphicsScene::linkSourcesForParameterValue(
589 QgsProcessingModelAlgorithm *model,
const QVariant &value,
const QString &childId,
QgsProcessingContext &context
592 QList<QgsModelGraphicsScene::LinkSource> res;
593 if ( value.userType() == QMetaType::Type::QVariantList )
595 const QVariantList list = value.toList();
596 for (
const QVariant &v : list )
597 res.append( linkSourcesForParameterValue( model, v, childId, context ) );
599 else if ( value.userType() == QMetaType::Type::QStringList )
601 const QStringList list = value.toStringList();
602 for (
const QString &v : list )
603 res.append( linkSourcesForParameterValue( model, v, childId, context ) );
605 else if ( value.userType() == qMetaTypeId<QgsProcessingModelChildParameterSource>() )
607 const QgsProcessingModelChildParameterSource source = value.value<QgsProcessingModelChildParameterSource>();
608 switch ( source.source() )
613 l.item = mParameterItems.value( source.parameterName() );
614 l.edge = Qt::BottomEdge;
622 if ( !model->childAlgorithm( source.outputChildId() ).algorithm() )
629 if ( output->name() == source.outputName() )
633 if ( mChildAlgorithmItems.contains( source.outputChildId() ) )
636 l.item = mChildAlgorithmItems.value( source.outputChildId() );
637 l.edge = Qt::BottomEdge;
640 if ( i >= model->childAlgorithm( source.outputChildId() ).algorithm()->outputDefinitions().length() )
642 QString short_message = tr(
"Check output links for alg: %1" ).arg( model->childAlgorithm( source.outputChildId() ).algorithm()->name() );
643 QString long_message = tr(
"Cannot link output for alg: %1" ).arg( model->childAlgorithm( source.outputChildId() ).algorithm()->name() );
644 QString title( tr(
"Algorithm link error" ) );
646 showWarning(
const_cast<QString &
>( short_message ),
const_cast<QString &
>( title ),
const_cast<QString &
>( long_message ) );
661 const QMap<QString, QgsProcessingModelAlgorithm::VariableDefinition> variables = model->variablesForChildAlgorithm( childId, &context );
663 const QSet<QString> vars = exp.referencedVariables();
664 for (
const QString &v : vars )
666 if ( variables.contains( v ) )
668 res.append( linkSourcesForParameterValue( model, QVariant::fromValue( variables.value( v ).source ), childId, context ) );
683void QgsModelGraphicsScene::addCommentItemForComponent( QgsProcessingModelAlgorithm *model,
const QgsProcessingModelComponent &component, QgsModelComponentGraphicItem *parentItem )
685 if ( mFlags & FlagHideComments || !component.comment() || component.comment()->description().isEmpty() )
688 QgsModelComponentGraphicItem *commentItem = createCommentGraphicItem( model, component.comment()->clone(), parentItem );
689 commentItem->registerWidgetContextGenerator( mWidgetContextGenerator );
690 commentItem->setPos( component.comment()->position().x(), component.comment()->position().y() );
691 addItem( commentItem );
692 connect( commentItem, &QgsModelComponentGraphicItem::requestModelRepaint,
this, &QgsModelGraphicsScene::rebuildRequired );
693 connect( commentItem, &QgsModelComponentGraphicItem::changed,
this, &QgsModelGraphicsScene::componentChanged );
694 connect( commentItem, &QgsModelComponentGraphicItem::aboutToChange,
this, &QgsModelGraphicsScene::componentAboutToChange );
696 auto arrow = std::make_unique<QgsModelArrowItem>( parentItem, QgsModelArrowItem::Circle, commentItem, QgsModelArrowItem::Circle );
697 arrow->setPenStyle( Qt::DotLine );
698 addItem( arrow.release() );
702void QgsModelGraphicsScene::addFeatureCountItemForArrow( QgsModelArrowItem *arrow,
const QString &layerId )
704 if ( mFlags & FlagHideFeatureCount )
706 arrow->setShowBadge(
false );
710 if ( !mLastResultCount.contains( layerId ) )
712 arrow->setShowBadge(
false );
716 arrow->setShowBadge(
true );
717 if ( QgsModelDesignerArrowBadgeItem *badge = arrow->badgeItem() )
719 badge->setValue( mLastResultCount.value( layerId ) );
729void QgsModelGraphicsScene::setMessageBar(
QgsMessageBar *messageBar )
731 mMessageBar = messageBar;
734void QgsModelGraphicsScene::showWarning(
const QString &shortMessage,
const QString &title,
const QString &longMessage,
Qgis::MessageLevel level )
const
737 QPushButton *detailsButton =
new QPushButton( tr(
"Details" ) );
738 connect( detailsButton, &QPushButton::clicked, detailsButton, [detailsButton, title, longMessage] {
744 messageWidget->layout()->addWidget( detailsButton );
745 mMessageBar->clearWidgets();
746 mMessageBar->pushWidget( messageWidget, level, 0 );
749void QgsModelGraphicsScene::requestRebuildRequired()
751 emit rebuildRequired();
MessageLevel
Level for messages This will be used both for message log and message bar in application.
@ Warning
Warning message.
@ 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.
Handles parsing and evaluation of expressions (formerly called "search strings").
Base class for all map layer types.
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, const char *file=__builtin_FILE(), const char *function=__builtin_FUNCTION(), int line=__builtin_LINE(), Qgis::StringFormat format=Qgis::StringFormat::PlainText)
Adds a message to the log instance (and creates it if necessary).
A generic message view for displaying QGIS messages.
void setMessage(const QString &message, Qgis::StringFormat format) override
Sets message, it won't be displayed until.
void setTitle(const QString &title) override
Sets title for the messages.
void showMessage(bool blocking=true) override
display the message to the user and deletes itself
Contains information about the context in which a processing algorithm is executed.
Encapsulates the results of running a child algorithm within a model.
A Processing feedback class with extra signals and properties specific to feedback from Processing mo...
void childStarted(const QString &childId, const QVariantMap &childParameters)
Emitted when a child algorithm has started executing.
void childResultReported(const QString &childId, const QgsProcessingModelChildAlgorithmResult &result)
Emitted when the result of a child algorithm has been reported.
void childSourceLoaded(const QString &childId, const QString ¶meterName, long long featureCount)
Emitted when a feature source was retrieved for the specified child algorithm input parameter.
void childProgressChanged(const QString &childId, double progress)
Emitted when a child algorithm changes progress.
void childSinkFeatureCountChanged(const QString &childId, const QString &childOutput, long long featureCount)
Emitted when the count of features pushed to a child's sink has changed.
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.
static QgsMapLayer * mapLayerFromString(const QString &string, QgsProcessingContext &context, bool allowLoadingNewLayers=true, QgsProcessingUtils::LayerHint typeHint=QgsProcessingUtils::LayerHint::UnknownType, QgsProcessing::LayerOptionsFlags flags=QgsProcessing::LayerOptionsFlags())
Interprets a string as a map layer within the supplied context.
An interface for objects which can create Processing widget contexts.
Represents a vector layer which manages a vector based dataset.
long long featureCount(const QString &legendKey) const
Number of features rendered with specified legend key.
QgsSignalBlocker< Object > whileBlocking(Object *object)
Temporarily blocks signals from a QObject while calling a single method from the object.
QList< const QgsProcessingOutputDefinition * > QgsProcessingOutputDefinitions
List of processing parameters.
QList< const QgsProcessingParameterDefinition * > QgsProcessingParameterDefinitions
List of processing parameters.