34#include <QApplication>
35#include <QGraphicsSceneHoverEvent>
41#include <QSvgRenderer>
43#include "moc_qgsmodelcomponentgraphicitem.cpp"
47QgsModelComponentGraphicItem::QgsModelComponentGraphicItem( QgsProcessingModelComponent *component, QgsProcessingModelAlgorithm *model, QGraphicsItem *parent )
48 : QGraphicsObject( parent )
49 , mComponent( component )
52 setAcceptHoverEvents(
true );
53 setFlag( QGraphicsItem::ItemIsSelectable,
true );
54 setFlag( QGraphicsItem::ItemSendsGeometryChanges,
true );
55 setZValue( QgsModelGraphicsScene::ZValues::ModelComponent );
57 mFont.setPixelSize( 12 );
61 QPainter painter( &editPicture );
62 svg.render( &painter );
64 mEditButton =
new QgsModelDesignerFlatButtonGraphicItem(
this, editPicture, QPointF( 0, 0 ) );
65 connect( mEditButton, &QgsModelDesignerFlatButtonGraphicItem::clicked,
this, &QgsModelComponentGraphicItem::editComponent );
68 QPicture deletePicture;
69 painter.begin( &deletePicture );
70 svg2.render( &painter );
72 mDeleteButton =
new QgsModelDesignerFlatButtonGraphicItem(
this, deletePicture, QPointF( 0, 0 ) );
73 connect( mDeleteButton, &QgsModelDesignerFlatButtonGraphicItem::clicked,
this, &QgsModelComponentGraphicItem::deleteComponent );
75 updateButtonPositions();
78QgsModelComponentGraphicItem::Flags QgsModelComponentGraphicItem::flags()
const
80 return QgsModelComponentGraphicItem::Flags();
83QgsModelComponentGraphicItem::~QgsModelComponentGraphicItem() =
default;
85QgsProcessingModelComponent *QgsModelComponentGraphicItem::component()
87 return mComponent.get();
90const QgsProcessingModelComponent *QgsModelComponentGraphicItem::component()
const
92 return mComponent.get();
95QgsProcessingModelAlgorithm *QgsModelComponentGraphicItem::model()
100const QgsProcessingModelAlgorithm *QgsModelComponentGraphicItem::model()
const
105QgsModelGraphicsView *QgsModelComponentGraphicItem::view()
107 if ( scene()->views().isEmpty() )
110 return qobject_cast<QgsModelGraphicsView *>( scene()->views().first() );
113QFont QgsModelComponentGraphicItem::font()
const
118void QgsModelComponentGraphicItem::setFont(
const QFont &font )
124void QgsModelComponentGraphicItem::moveComponentBy( qreal dx, qreal dy )
126 setPos( mComponent->position().x() + dx, mComponent->position().y() + dy );
127 mComponent->setPosition( pos() );
129 emit aboutToChange( tr(
"Move %1" ).arg( mComponent->description() ) );
130 updateStoredComponentPosition( pos(), mComponent->size() );
133 emit sizePositionChanged();
134 emit updateArrowPaths();
137void QgsModelComponentGraphicItem::previewItemMove( qreal dx, qreal dy )
139 setPos( mComponent->position().x() + dx, mComponent->position().y() + dy );
140 emit updateArrowPaths();
143void QgsModelComponentGraphicItem::setItemRect( QRectF rect )
145 rect = rect.normalized();
147 if ( rect.width() < MIN_COMPONENT_WIDTH )
148 rect.setWidth( MIN_COMPONENT_WIDTH );
149 if ( rect.height() < MIN_COMPONENT_HEIGHT )
150 rect.setHeight( MIN_COMPONENT_HEIGHT );
152 setPos( rect.center() );
153 prepareGeometryChange();
155 emit aboutToChange( tr(
"Resize %1" ).arg( mComponent->description() ) );
157 mComponent->setPosition( pos() );
158 mComponent->setSize( rect.size() );
159 updateStoredComponentPosition( pos(), mComponent->size() );
161 updateButtonPositions();
164 emit updateArrowPaths();
165 emit sizePositionChanged();
168QRectF QgsModelComponentGraphicItem::previewItemRectChange( QRectF rect )
170 rect = rect.normalized();
172 if ( rect.width() < MIN_COMPONENT_WIDTH )
173 rect.setWidth( MIN_COMPONENT_WIDTH );
174 if ( rect.height() < MIN_COMPONENT_HEIGHT )
175 rect.setHeight( MIN_COMPONENT_HEIGHT );
177 setPos( rect.center() );
178 prepareGeometryChange();
180 mTempSize = rect.size();
182 updateButtonPositions();
183 emit updateArrowPaths();
188void QgsModelComponentGraphicItem::finalizePreviewedItemRectChange( QRectF )
190 mComponent->setPosition( pos() );
191 prepareGeometryChange();
192 mComponent->setSize( mTempSize );
193 mTempSize = QSizeF();
195 emit aboutToChange( tr(
"Resize %1" ).arg( mComponent->description() ) );
196 updateStoredComponentPosition( pos(), mComponent->size() );
198 updateButtonPositions();
202 emit sizePositionChanged();
203 emit updateArrowPaths();
208 if ( view() && view()->tool() && view()->tool()->allowItemInteraction() )
209 updateToolTip( mapFromScene( event->
modelPoint() ) );
214 if ( view() && view()->tool() && view()->tool()->allowItemInteraction() )
215 updateToolTip( mapFromScene( event->
modelPoint() ) );
220 if ( view() && view()->tool() && view()->tool()->allowItemInteraction() )
222 setToolTip( QString() );
227 emit repaintArrows();
234 if ( view() && view()->tool() && view()->tool()->allowItemInteraction() )
238void QgsModelComponentGraphicItem::mouseDoubleClickEvent( QGraphicsSceneMouseEvent * )
240 if ( view() && view()->tool() && view()->tool()->allowItemInteraction() )
244void QgsModelComponentGraphicItem::hoverEnterEvent( QGraphicsSceneHoverEvent *event )
246 if ( view() && view()->tool() && view()->tool()->allowItemInteraction() )
247 updateToolTip( event->pos() );
250void QgsModelComponentGraphicItem::hoverMoveEvent( QGraphicsSceneHoverEvent *event )
252 if ( view() && view()->tool() && view()->tool()->allowItemInteraction() )
253 updateToolTip( event->pos() );
256void QgsModelComponentGraphicItem::hoverLeaveEvent( QGraphicsSceneHoverEvent * )
258 modelHoverLeaveEvent(
nullptr );
261QVariant QgsModelComponentGraphicItem::itemChange( QGraphicsItem::GraphicsItemChange change,
const QVariant &value )
265 case QGraphicsItem::ItemSelectedChange:
267 emit repaintArrows();
271 case QGraphicsItem::ItemSceneChange:
276 if ( linkPointCount( Qt::TopEdge ) )
278 mExpandTopButton =
new QgsModelDesignerFoldButtonGraphicItem(
this, mComponent->linksCollapsed( Qt::TopEdge ), QPointF( 0, 0 ) );
279 connect( mExpandTopButton, &QgsModelDesignerFoldButtonGraphicItem::folded,
this, [
this](
bool folded ) { fold( Qt::TopEdge, folded ); } );
281 for (
int idx = 0; idx < linkPointCount( Qt::TopEdge ); ++idx )
283 mInSockets.append(
new QgsModelDesignerSocketGraphicItem(
this, mComponent.get(), idx, QPointF( 0, 0 ), Qt::TopEdge ) );
286 if ( linkPointCount( Qt::BottomEdge ) )
288 mExpandBottomButton =
new QgsModelDesignerFoldButtonGraphicItem(
this, mComponent->linksCollapsed( Qt::BottomEdge ), QPointF( 0, 0 ) );
289 connect( mExpandBottomButton, &QgsModelDesignerFoldButtonGraphicItem::folded,
this, [
this](
bool folded ) { fold( Qt::BottomEdge, folded ); } );
291 for (
int idx = 0; idx < linkPointCount( Qt::BottomEdge ); ++idx )
293 mOutSockets.append(
new QgsModelDesignerSocketGraphicItem(
this, mComponent.get(), idx, QPointF( 0, 0 ), Qt::BottomEdge ) );
297 updateButtonPositions();
306 return QGraphicsObject::itemChange( change, value );
309QRectF QgsModelComponentGraphicItem::boundingRect()
const
311 const QFontMetricsF fm( mFont );
312 const int linksAbove = linkPointCount( Qt::TopEdge );
313 const int linksBelow = linkPointCount( Qt::BottomEdge );
315 const double hUp = linksAbove == 0 ? 0 : fm.height() * 1.2 * ( ( mComponent->linksCollapsed( Qt::TopEdge ) ? 0 : linksAbove ) + 2 );
316 const double hDown = linksBelow == 0 ? 0 : fm.height() * 1.2 * ( ( mComponent->linksCollapsed( Qt::BottomEdge ) ? 0 : linksBelow ) + 2 );
317 return QRectF( -( itemSize().width() ) / 2 - RECT_PEN_SIZE, -( itemSize().height() ) / 2 - hUp - RECT_PEN_SIZE, itemSize().width() + 2 * RECT_PEN_SIZE, itemSize().height() + hDown + hUp + 2 * RECT_PEN_SIZE );
320bool QgsModelComponentGraphicItem::contains(
const QPointF &point )
const
322 const QRectF paintingBounds = boundingRect();
323 if ( point.x() < paintingBounds.left() + RECT_PEN_SIZE )
325 if ( point.x() > paintingBounds.right() - RECT_PEN_SIZE )
327 if ( point.y() < paintingBounds.top() + RECT_PEN_SIZE )
329 if ( point.y() > paintingBounds.bottom() - RECT_PEN_SIZE )
335void QgsModelComponentGraphicItem::paint( QPainter *painter,
const QStyleOptionGraphicsItem *, QWidget * )
337 const QRectF rect = itemRect();
341 if ( mComponent->color().isValid() )
343 color = mComponent->color();
347 color = color.darker( 110 );
350 color = color.darker( 105 );
356 stroke = color.darker( 110 );
357 foreColor = color.lightness() > 150 ? QColor( 0, 0, 0 ) : QColor( 255, 255, 255 );
361 color = fillColor( state() );
362 stroke = strokeColor( state() );
363 foreColor = textColor( state() );
366 QPen strokePen = QPen( stroke, 0 );
367 strokePen.setStyle( strokeStyle( state() ) );
368 painter->setPen( strokePen );
369 painter->setBrush( QBrush( color, Qt::SolidPattern ) );
370 painter->drawRect( rect );
371 painter->setFont( font() );
372 painter->setPen( QPen( foreColor ) );
376 const QSizeF componentSize = itemSize();
378 const QFontMetricsF fm( font() );
379 double h = fm.ascent();
380 QPointF pt( -componentSize.width() / 2 + 25, componentSize.height() / 2.0 - h + 1 );
382 if ( iconPicture().isNull() && iconPixmap().isNull() )
384 const QRectF labelRect = QRectF( rect.left() + TEXT_MARGIN, rect.top() + TEXT_MARGIN, rect.width() - 2 * TEXT_MARGIN - mButtonSize.width() - BUTTON_MARGIN, rect.height() - 2 * TEXT_MARGIN );
386 painter->drawText( labelRect, Qt::TextWordWrap | titleAlignment(), text );
390 const QRectF labelRect = QRectF( rect.left() + 21 + TEXT_MARGIN, rect.top() + TEXT_MARGIN, rect.width() - 2 * TEXT_MARGIN - mButtonSize.width() - BUTTON_MARGIN - 21, rect.height() - 2 * TEXT_MARGIN );
392 painter->drawText( labelRect, Qt::TextWordWrap | Qt::AlignVCenter, text );
395 painter->setPen( QPen( QApplication::palette().color( QPalette::Text ) ) );
397 if ( linkPointCount( Qt::TopEdge ) )
399 h = -( fm.height() * 1.2 );
400 h = h - componentSize.height() / 2.0 + 5;
401 pt = QPointF( -componentSize.width() / 2 + 25, h );
402 painter->drawText( pt, QObject::tr(
"In" ) );
404 if ( !mComponent->linksCollapsed( Qt::TopEdge ) )
406 for (
int idx = 0; idx < linkPointCount( Qt::TopEdge ); ++idx )
408 text = linkPointText( Qt::TopEdge, idx );
409 h = -( fm.height() * 1.2 ) * ( i + 1 );
410 h = h - componentSize.height() / 2.0 + 5;
411 pt = QPointF( -componentSize.width() / 2 + 33, h );
412 painter->drawText( pt, text );
417 if ( linkPointCount( Qt::BottomEdge ) )
419 h = fm.height() * 1.1;
420 h = h + componentSize.height() / 2.0;
421 pt = QPointF( -componentSize.width() / 2 + 25, h );
422 painter->drawText( pt, QObject::tr(
"Out" ) );
423 if ( !mComponent->linksCollapsed( Qt::BottomEdge ) )
425 for (
int idx = 0; idx < linkPointCount( Qt::BottomEdge ); ++idx )
427 text = linkPointText( Qt::BottomEdge, idx );
428 h = fm.height() * 1.2 * ( idx + 2 );
429 h = h + componentSize.height() / 2.0;
430 pt = QPointF( -componentSize.width() / 2 + 33, h );
431 painter->drawText( pt, text );
436 const QPixmap px = iconPixmap();
439 painter->drawPixmap( QPointF( -( componentSize.width() / 2.0 ) + 3, -8 ), px );
443 const QPicture pic = iconPicture();
446 painter->drawPicture( QPointF( -( componentSize.width() / 2.0 ) + 3, -8 ), pic );
451QRectF QgsModelComponentGraphicItem::itemRect(
bool storedRect )
const
455 return QRectF( mComponent->position().x() - ( mComponent->size().width() ) / 2.0, mComponent->position().y() - ( mComponent->size().height() ) / 2.0, mComponent->size().width(), mComponent->size().height() );
458 return QRectF( -( itemSize().width() ) / 2.0, -( itemSize().height() ) / 2.0, itemSize().width(), itemSize().height() );
461QString QgsModelComponentGraphicItem::truncatedTextForItem(
const QString &text )
const
463 const QFontMetricsF fm( mFont );
464 double width = fm.boundingRect( text ).width();
465 if ( width < itemSize().width() - 25 - mButtonSize.width() )
469 t = t.left( t.length() - 3 ) + QChar( 0x2026 );
470 width = fm.boundingRect( t ).width();
471 while ( width > itemSize().width() - 25 - mButtonSize.width() )
473 if ( t.length() < 5 )
476 t = t.left( t.length() - 4 ) + QChar( 0x2026 );
477 width = fm.boundingRect( t ).width();
482Qt::PenStyle QgsModelComponentGraphicItem::strokeStyle( QgsModelComponentGraphicItem::State )
const
484 return Qt::SolidLine;
487Qt::Alignment QgsModelComponentGraphicItem::titleAlignment()
const
489 return Qt::AlignLeft;
492QPicture QgsModelComponentGraphicItem::iconPicture()
const
497QPixmap QgsModelComponentGraphicItem::iconPixmap()
const
503void QgsModelComponentGraphicItem::updateButtonPositions()
505 mEditButton->setPosition( QPointF( itemSize().width() / 2.0 - mButtonSize.width() / 2.0 - BUTTON_MARGIN, itemSize().height() / 2.0 - mButtonSize.height() / 2.0 - BUTTON_MARGIN ) );
506 mDeleteButton->setPosition( QPointF( itemSize().width() / 2.0 - mButtonSize.width() / 2.0 - BUTTON_MARGIN, mButtonSize.height() / 2.0 - itemSize().height() / 2.0 + BUTTON_MARGIN ) );
508 if ( mExpandBottomButton )
510 const QPointF pt = linkPoint( Qt::BottomEdge, -1,
false );
511 mExpandBottomButton->setPosition( QPointF( 0, pt.y() ) );
513 bool collapsed = mComponent->linksCollapsed( Qt::BottomEdge );
514 for ( QgsModelDesignerSocketGraphicItem *socket : std::as_const( mOutSockets ) )
516 const QPointF pt = linkPoint( Qt::BottomEdge, socket->index(),
false );
517 socket->setPosition( pt );
518 socket->setVisible( !collapsed );
523 if ( mExpandTopButton )
525 const QPointF pt = linkPoint( Qt::TopEdge, -1,
true );
526 mExpandTopButton->setPosition( QPointF( 0, pt.y() ) );
528 bool collapsed = mComponent->linksCollapsed( Qt::TopEdge );
529 for ( QgsModelDesignerSocketGraphicItem *socket : std::as_const( mInSockets ) )
531 const QPointF pt = linkPoint( Qt::TopEdge, socket->index(),
true );
532 socket->setPosition( pt );
533 socket->setVisible( !collapsed );
539QSizeF QgsModelComponentGraphicItem::itemSize()
const
541 return !mTempSize.isValid() ? mComponent->size() : mTempSize;
544void QgsModelComponentGraphicItem::updateToolTip(
const QPointF &pos )
546 const bool prevHoverStatus = mIsHovering;
547 if ( itemRect().contains( pos ) )
549 setToolTip( mLabel );
554 setToolTip( QString() );
557 if ( mIsHovering != prevHoverStatus )
560 emit repaintArrows();
564void QgsModelComponentGraphicItem::fold( Qt::Edge edge,
bool folded )
566 emit aboutToChange( !folded ? tr(
"Expand Item" ) : tr(
"Collapse Item" ) );
567 mComponent->setLinksCollapsed( edge, folded );
571 if ( QgsProcessingModelChildAlgorithm *child =
dynamic_cast<QgsProcessingModelChildAlgorithm *
>( mComponent.get() ) )
573 mModel->childAlgorithm( child->childId() ).setLinksCollapsed( edge, folded );
575 else if ( QgsProcessingModelParameter *param =
dynamic_cast<QgsProcessingModelParameter *
>( mComponent.get() ) )
577 mModel->parameterComponent( param->parameterName() ).setLinksCollapsed( edge, folded );
579 else if ( QgsProcessingModelOutput *output =
dynamic_cast<QgsProcessingModelOutput *
>( mComponent.get() ) )
581 mModel->childAlgorithm( output->childId() ).modelOutput( output->name() ).setLinksCollapsed( edge, folded );
584 updateButtonPositions();
585 prepareGeometryChange();
586 emit updateArrowPaths();
591QString QgsModelComponentGraphicItem::label()
const
596void QgsModelComponentGraphicItem::setLabel(
const QString &label )
602QgsModelComponentGraphicItem::State QgsModelComponentGraphicItem::state()
const
606 else if ( mIsHovering )
612int QgsModelComponentGraphicItem::linkPointCount( Qt::Edge )
const
617QString QgsModelComponentGraphicItem::linkPointText( Qt::Edge,
int )
const
622QPointF QgsModelComponentGraphicItem::linkPoint( Qt::Edge edge,
int index,
bool incoming )
const
628 if ( linkPointCount( Qt::BottomEdge ) )
631 if ( mComponent->linksCollapsed( Qt::BottomEdge ) )
635 const int pointIndex = !mComponent->linksCollapsed( Qt::BottomEdge ) ? index : -1;
636 const QString text = truncatedTextForItem( linkPointText( Qt::BottomEdge, index ) );
637 const QFontMetricsF fm( mFont );
638 const double w = fm.boundingRect( text ).width();
639 const double h = fm.height() * 1.2 * ( pointIndex + 1 ) + fm.height() / 2.0;
640 const double y = h + itemSize().height() / 2.0 + 6.4;
641 const double x = !mComponent->linksCollapsed( Qt::BottomEdge ) ? ( -itemSize().width() / 2 + 33 + w + 10 ) : 10.4;
642 return QPointF( incoming ? -itemSize().width() / 2 + offsetX : x, y );
649 if ( linkPointCount( Qt::TopEdge ) )
652 int paramIndex = index;
653 if ( mComponent->linksCollapsed( Qt::TopEdge ) )
658 const QFontMetricsF fm( mFont );
659 const QString text = truncatedTextForItem( linkPointText( Qt::TopEdge, index ) );
660 const double w = fm.boundingRect( text ).width();
661 double h = -( fm.height() * 1.2 ) * ( paramIndex + 2 ) - fm.height() / 2.0 + 8;
662 h = h - itemSize().height() / 2.0;
663 return QPointF( incoming ? -itemSize().width() / 2 + offsetX : ( !mComponent->linksCollapsed( Qt::TopEdge ) ? ( -itemSize().width() / 2 + 33 + w + 5 ) : 10 ), h );
675QPointF QgsModelComponentGraphicItem::calculateAutomaticLinkPoint( QgsModelComponentGraphicItem *other, Qt::Edge &edge )
const
678 const QgsRectangle otherRect( other->itemRect().translated( other->pos() ) );
680 const QPointF leftPoint = pos() + QPointF( -itemSize().width() / 2.0, 0 );
681 const double distLeft = otherRect.distance(
QgsPointXY( leftPoint ) );
683 const QPointF rightPoint = pos() + QPointF( itemSize().width() / 2.0, 0 );
684 const double distRight = otherRect.distance(
QgsPointXY( rightPoint ) );
686 const QPointF topPoint = pos() + QPointF( 0, -itemSize().height() / 2.0 );
687 const double distTop = otherRect.distance(
QgsPointXY( topPoint ) );
689 const QPointF bottomPoint = pos() + QPointF( 0, itemSize().height() / 2.0 );
690 const double distBottom = otherRect.distance(
QgsPointXY( bottomPoint ) );
692 if ( distLeft <= distRight && distLeft <= distTop && distLeft <= distBottom )
697 else if ( distRight <= distTop && distRight <= distBottom )
699 edge = Qt::RightEdge;
702 else if ( distBottom <= distTop )
704 edge = Qt::BottomEdge;
714QPointF QgsModelComponentGraphicItem::calculateAutomaticLinkPoint(
const QPointF &point, Qt::Edge &edge )
const
718 const QPointF leftPoint = pos() + QPointF( -itemSize().width() / 2.0, 0 );
719 const double distLeft = otherPt.distance(
QgsPointXY( leftPoint ) );
721 const QPointF rightPoint = pos() + QPointF( itemSize().width() / 2.0, 0 );
722 const double distRight = otherPt.distance(
QgsPointXY( rightPoint ) );
724 const QPointF topPoint = pos() + QPointF( 0, -itemSize().height() / 2.0 );
725 const double distTop = otherPt.distance(
QgsPointXY( topPoint ) );
727 const QPointF bottomPoint = pos() + QPointF( 0, itemSize().height() / 2.0 );
728 const double distBottom = otherPt.distance(
QgsPointXY( bottomPoint ) );
730 if ( distLeft <= distRight && distLeft <= distTop && distLeft <= distBottom )
735 else if ( distRight <= distTop && distRight <= distBottom )
737 edge = Qt::RightEdge;
740 else if ( distBottom <= distTop )
742 edge = Qt::BottomEdge;
752QgsModelDesignerSocketGraphicItem *QgsModelComponentGraphicItem::outSocketAt(
int index )
const
754 if ( index < 0 || index >= mOutSockets.size() )
758 return mOutSockets.at( index );
761QgsModelParameterGraphicItem::QgsModelParameterGraphicItem( QgsProcessingModelParameter *parameter, QgsProcessingModelAlgorithm *model, QGraphicsItem *parent )
762 : QgsModelComponentGraphicItem( parameter, model, parent )
765 QPainter painter( &mPicture );
766 svg.render( &painter );
770 setLabel( parameterDefinition->description() );
772 setLabel( QObject::tr(
"Error (%1)" ).arg( parameter->parameterName() ) );
775void QgsModelParameterGraphicItem::contextMenuEvent( QGraphicsSceneContextMenuEvent *event )
777 QMenu *popupmenu =
new QMenu( event->widget() );
778 QAction *removeAction = popupmenu->addAction( QObject::tr(
"Remove" ) );
779 connect( removeAction, &QAction::triggered,
this, &QgsModelParameterGraphicItem::deleteComponent );
780 QAction *editAction = popupmenu->addAction( QObject::tr(
"Edit…" ) );
781 connect( editAction, &QAction::triggered,
this, &QgsModelParameterGraphicItem::editComponent );
782 QAction *editCommentAction = popupmenu->addAction( component()->comment()->description().isEmpty() ? QObject::tr(
"Add Comment…" ) : QObject::tr(
"Edit Comment…" ) );
783 connect( editCommentAction, &QAction::triggered,
this, &QgsModelParameterGraphicItem::editComment );
785 popupmenu->exec( event->screenPos() );
788QColor QgsModelParameterGraphicItem::fillColor( QgsModelComponentGraphicItem::State state )
const
790 QColor
c( 238, 242, 131 );
806QColor QgsModelParameterGraphicItem::strokeColor( QgsModelComponentGraphicItem::State state )
const
811 return QColor( 116, 113, 68 );
814 return QColor( 234, 226, 118 );
819QColor QgsModelParameterGraphicItem::textColor( QgsModelComponentGraphicItem::State )
const
824QPicture QgsModelParameterGraphicItem::iconPicture()
const
829int QgsModelParameterGraphicItem::linkPointCount( Qt::Edge edge )
const
844QString QgsModelParameterGraphicItem::linkPointText( Qt::Edge,
int index )
const
851 if (
const QgsProcessingModelParameter *parameter =
dynamic_cast< const QgsProcessingModelParameter *
>( component() ) )
853 QString text = this->model()->parameterDefinition( parameter->parameterName() )->type();
858 const QVariant paramValue = paramDef->defaultValue();
860 if ( paramValue.isValid() )
862 text +=
": " + paramDef->userFriendlyString( paramValue );
865 return truncatedTextForItem( text );
871QColor QgsModelParameterGraphicItem::linkColor( Qt::Edge ,
int index )
const
875 return FALLBACK_COLOR;
878 if (
const QgsProcessingModelParameter *parameter =
dynamic_cast< const QgsProcessingModelParameter *
>( component() ) )
882 return parameterDefinition->modelColor();
886 return FALLBACK_COLOR;
889void QgsModelParameterGraphicItem::updateStoredComponentPosition(
const QPointF &pos,
const QSizeF &size )
891 if ( QgsProcessingModelParameter *param =
dynamic_cast<QgsProcessingModelParameter *
>( component() ) )
893 model()->parameterComponent( param->parameterName() ).setPosition( pos );
894 model()->parameterComponent( param->parameterName() ).setSize( size );
898bool QgsModelParameterGraphicItem::canDeleteComponent()
900 if (
const QgsProcessingModelParameter *param =
dynamic_cast<const QgsProcessingModelParameter *
>( component() ) )
902 if ( model()->childAlgorithmsDependOnParameter( param->parameterName() ) )
906 else if ( model()->otherParametersDependOnParameter( param->parameterName() ) )
918void QgsModelParameterGraphicItem::deleteComponent()
920 if (
const QgsProcessingModelParameter *param =
dynamic_cast<const QgsProcessingModelParameter *
>( component() ) )
922 if ( model()->childAlgorithmsDependOnParameter( param->parameterName() ) )
924 QMessageBox::warning(
nullptr, QObject::tr(
"Could not remove input" ), QObject::tr(
"Algorithms depend on the selected input.\n"
925 "Remove them before trying to remove it." ) );
927 else if ( model()->otherParametersDependOnParameter( param->parameterName() ) )
929 QMessageBox::warning(
nullptr, QObject::tr(
"Could not remove input" ), QObject::tr(
"Other inputs depend on the selected input.\n"
930 "Remove them before trying to remove it." ) );
934 emit aboutToChange( tr(
"Delete Input %1" ).arg( param->description() ) );
935 model()->removeModelParameter( param->parameterName() );
937 emit requestModelRepaint();
943QgsModelChildAlgorithmGraphicItem::QgsModelChildAlgorithmGraphicItem( QgsProcessingModelChildAlgorithm *child, QgsProcessingModelAlgorithm *model, QGraphicsItem *parent )
944 : QgsModelComponentGraphicItem( child, model, parent )
946 if ( child->algorithm() && !child->algorithm()->svgIconPath().isEmpty() )
948 QSvgRenderer svg( child->algorithm()->svgIconPath() );
949 const QSizeF size = svg.defaultSize();
950 QPainter painter( &mPicture );
951 painter.scale( 16.0 / size.width(), 16.0 / size.width() );
952 svg.render( &painter );
955 else if ( child->algorithm() )
957 mPixmap = child->algorithm()->icon().pixmap( 15, 15 );
960 setLabel( child->description() );
963 mIsValid = model->validateChildAlgorithm( child->childId(), issues );
966void QgsModelChildAlgorithmGraphicItem::contextMenuEvent( QGraphicsSceneContextMenuEvent *event )
968 QMenu *popupmenu =
new QMenu( event->widget() );
972 QAction *runSelectedStepsAction = popupmenu->addAction( QObject::tr(
"Run Selected Steps…" ) );
974 connect( runSelectedStepsAction, &QAction::triggered,
this, &QgsModelChildAlgorithmGraphicItem::runSelected );
977 QAction *runFromHereAction = popupmenu->addAction( QObject::tr(
"Run from Here…" ) );
979 connect( runFromHereAction, &QAction::triggered,
this, &QgsModelChildAlgorithmGraphicItem::runFromHere );
981 popupmenu->addSeparator();
983 QAction *removeAction = popupmenu->addAction( QObject::tr(
"Remove" ) );
984 connect( removeAction, &QAction::triggered,
this, &QgsModelChildAlgorithmGraphicItem::deleteComponent );
985 QAction *editAction = popupmenu->addAction( QObject::tr(
"Edit…" ) );
986 connect( editAction, &QAction::triggered,
this, &QgsModelChildAlgorithmGraphicItem::editComponent );
987 QAction *editCommentAction = popupmenu->addAction( component()->comment()->description().isEmpty() ? QObject::tr(
"Add Comment…" ) : QObject::tr(
"Edit Comment…" ) );
988 connect( editCommentAction, &QAction::triggered,
this, &QgsModelParameterGraphicItem::editComment );
989 popupmenu->addSeparator();
991 if (
const QgsProcessingModelChildAlgorithm *child =
dynamic_cast<const QgsProcessingModelChildAlgorithm *
>( component() ) )
993 if ( !child->isActive() )
995 QAction *activateAction = popupmenu->addAction( QObject::tr(
"Activate" ) );
996 connect( activateAction, &QAction::triggered,
this, &QgsModelChildAlgorithmGraphicItem::activateAlgorithm );
1000 QAction *deactivateAction = popupmenu->addAction( QObject::tr(
"Deactivate" ) );
1001 connect( deactivateAction, &QAction::triggered,
this, &QgsModelChildAlgorithmGraphicItem::deactivateAlgorithm );
1007 const QList<const QgsProcessingParameterDefinition *> outputParams =
algorithm->destinationParameterDefinitions();
1008 if ( !outputParams.isEmpty() )
1010 popupmenu->addSeparator();
1011 QAction *viewOutputLayersAction = popupmenu->addAction( QObject::tr(
"View Output Layers" ) );
1013 connect( viewOutputLayersAction, &QAction::triggered,
this, &QgsModelChildAlgorithmGraphicItem::showPreviousResults );
1015 switch ( mResults.executionStatus() )
1019 viewOutputLayersAction->setEnabled(
false );
1028 QAction *viewLogAction = popupmenu->addAction( QObject::tr(
"View Log…" ) );
1029 connect( viewLogAction, &QAction::triggered,
this, &QgsModelChildAlgorithmGraphicItem::showLog );
1031 switch ( mResults.executionStatus() )
1034 viewLogAction->setEnabled(
false );
1043 popupmenu->exec( event->screenPos() );
1046QColor QgsModelChildAlgorithmGraphicItem::fillColor( QgsModelComponentGraphicItem::State state )
const
1051 c = QColor( 255, 255, 255 );
1053 c = QColor( 208, 0, 0 );
1058 c =
c.darker( 110 );
1061 c =
c.darker( 105 );
1070QColor QgsModelChildAlgorithmGraphicItem::strokeColor( QgsModelComponentGraphicItem::State state )
const
1075 return mIsValid ? QColor( 50, 50, 50 ) : QColor( 80, 0, 0 );
1078 return mIsValid ? Qt::gray : QColor( 134, 0, 0 );
1083QColor QgsModelChildAlgorithmGraphicItem::textColor( QgsModelComponentGraphicItem::State )
const
1085 return mIsValid ? ( qgis::down_cast<const QgsProcessingModelChildAlgorithm *>( component() )->isActive() ? Qt::black : Qt::gray ) : QColor( 255, 255, 255 );
1088QPixmap QgsModelChildAlgorithmGraphicItem::iconPixmap()
const
1093QPicture QgsModelChildAlgorithmGraphicItem::iconPicture()
const
1098int QgsModelChildAlgorithmGraphicItem::linkPointCount( Qt::Edge edge )
const
1100 if (
const QgsProcessingModelChildAlgorithm *child =
dynamic_cast<const QgsProcessingModelChildAlgorithm *
>( component() ) )
1102 if ( !child->algorithm() )
1107 case Qt::BottomEdge:
1108 return child->algorithm()->outputDefinitions().size();
1113 return param->flags() & Qgis::ProcessingParameterFlag::Hidden || param->isDestination();
1116 return params.size();
1127QColor QgsModelComponentGraphicItem::linkColor( Qt::Edge edge,
int index )
const
1129 if (
const QgsProcessingModelChildAlgorithm *child =
dynamic_cast<const QgsProcessingModelChildAlgorithm *
>( component() ) )
1131 if ( !child->algorithm() )
1133 return FALLBACK_COLOR;
1138 case Qt::BottomEdge:
1140 if ( index <= child->
algorithm()->outputDefinitions().size() - 1 )
1142 return child->algorithm()->outputDefinitions().at( index )->modelColor();
1144 return FALLBACK_COLOR;
1150 if ( index <= params.size() - 1 )
1152 return params.at( index )->modelColor();
1155 return FALLBACK_COLOR;
1164 return FALLBACK_COLOR;
1167QString QgsModelChildAlgorithmGraphicItem::linkPointText( Qt::Edge edge,
int index )
const
1172 if (
const QgsProcessingModelChildAlgorithm *child =
dynamic_cast<const QgsProcessingModelChildAlgorithm *
>( component() ) )
1174 if ( !child->algorithm() )
1179 case Qt::BottomEdge:
1181 if ( index >= child->algorithm()->outputDefinitions().length() )
1185 tr(
"Cannot link output for child: %1" ).arg( child->algorithm()->name() ),
1193 return truncatedTextForItem( title );
1200 return param->flags() & Qgis::ProcessingParameterFlag::Hidden || param->isDestination();
1204 if ( index >= params.length() )
1208 tr(
"Cannot link source for child: %1" ).arg( child->algorithm()->name() ),
1215 QString name = param->
name();
1217 QgsProcessingModelChildParameterSources paramSources = child->parameterSources().value( name );
1218 QString parameterValueAsString;
1220 if ( !paramSources.empty() )
1222 QgsProcessingModelChildParameterSource firstParameterSource = paramSources[0];
1224 switch ( firstParameterSource.source() )
1227 parameterValueAsString = QStringLiteral(
": %1" ).arg(
1228 firstParameterSource.friendlyIdentifier(
const_cast<QgsProcessingModelAlgorithm *
>( model() ) )
1233 parameterValueAsString = QStringLiteral(
": %1" ).arg( firstParameterSource.expression() );
1237 parameterValueAsString = QStringLiteral(
": %1" ).arg( firstParameterSource.expressionText() );
1241 parameterValueAsString = QStringLiteral(
": <%1>" ).arg( firstParameterSource.friendlyIdentifier(
const_cast<QgsProcessingModelAlgorithm *
>( model() ) ) );
1246 const QString friendlyName = firstParameterSource.friendlyIdentifier(
const_cast<QgsProcessingModelAlgorithm *
>( model() ) );
1247 parameterValueAsString = friendlyName.isEmpty() ? QStringLiteral(
":" ) : QStringLiteral(
": <%1>" ).arg( friendlyName );
1252 const QVariant paramValue = paramSources[0].staticValue();
1253 parameterValueAsString = QStringLiteral(
": %1" ).arg( param->
userFriendlyString( paramValue ) );
1255 title += parameterValueAsString;
1258 return truncatedTextForItem( title );
1269void QgsModelChildAlgorithmGraphicItem::updateStoredComponentPosition(
const QPointF &pos,
const QSizeF &size )
1271 if ( QgsProcessingModelChildAlgorithm *child =
dynamic_cast<QgsProcessingModelChildAlgorithm *
>( component() ) )
1273 model()->childAlgorithm( child->childId() ).setPosition( pos );
1274 model()->childAlgorithm( child->childId() ).setSize( size );
1278bool QgsModelChildAlgorithmGraphicItem::canDeleteComponent()
1280 if (
const QgsProcessingModelChildAlgorithm *child =
dynamic_cast<const QgsProcessingModelChildAlgorithm *
>( component() ) )
1282 return model()->dependentChildAlgorithms( child->childId() ).empty();
1289 if ( mResults == results )
1294 emit updateArrowPaths();
1297void QgsModelChildAlgorithmGraphicItem::deleteComponent()
1299 if (
const QgsProcessingModelChildAlgorithm *child =
dynamic_cast<const QgsProcessingModelChildAlgorithm *
>( component() ) )
1301 emit aboutToChange( tr(
"Remove %1" ).arg( child->algorithm() ? child->algorithm()->displayName() : tr(
"Algorithm" ) ) );
1302 if ( !model()->removeChildAlgorithm( child->childId() ) )
1304 QMessageBox::warning(
nullptr, QObject::tr(
"Could not remove algorithm" ), QObject::tr(
"Other algorithms depend on the selected one.\n"
1305 "Remove them before trying to remove it." ) );
1310 emit requestModelRepaint();
1315void QgsModelChildAlgorithmGraphicItem::deactivateAlgorithm()
1317 if (
const QgsProcessingModelChildAlgorithm *child =
dynamic_cast<const QgsProcessingModelChildAlgorithm *
>( component() ) )
1319 model()->deactivateChildAlgorithm( child->childId() );
1320 emit requestModelRepaint();
1324void QgsModelChildAlgorithmGraphicItem::activateAlgorithm()
1326 if (
const QgsProcessingModelChildAlgorithm *child =
dynamic_cast<const QgsProcessingModelChildAlgorithm *
>( component() ) )
1328 if ( model()->activateChildAlgorithm( child->childId() ) )
1330 emit requestModelRepaint();
1334 QMessageBox::warning(
nullptr, QObject::tr(
"Could not activate algorithm" ), QObject::tr(
"The selected algorithm depends on other currently non-active algorithms.\n"
1335 "Activate them them before trying to activate it.." ) );
1341QgsModelOutputGraphicItem::QgsModelOutputGraphicItem( QgsProcessingModelOutput *output, QgsProcessingModelAlgorithm *model, QGraphicsItem *parent )
1342 : QgsModelComponentGraphicItem( output, model, parent )
1345 QPainter painter( &mPicture );
1346 svg.render( &painter );
1348 setLabel( output->description() );
1351QColor QgsModelOutputGraphicItem::fillColor( QgsModelComponentGraphicItem::State state )
const
1353 QColor
c( 172, 196, 114 );
1357 c =
c.darker( 110 );
1360 c =
c.darker( 105 );
1369QColor QgsModelOutputGraphicItem::strokeColor( QgsModelComponentGraphicItem::State state )
const
1374 return QColor( 42, 65, 42 );
1377 return QColor( 90, 140, 90 );
1382QColor QgsModelOutputGraphicItem::textColor( QgsModelComponentGraphicItem::State )
const
1387QPicture QgsModelOutputGraphicItem::iconPicture()
const
1392void QgsModelOutputGraphicItem::updateStoredComponentPosition(
const QPointF &pos,
const QSizeF &size )
1394 if ( QgsProcessingModelOutput *output =
dynamic_cast<QgsProcessingModelOutput *
>( component() ) )
1396 model()->childAlgorithm( output->childId() ).modelOutput( output->name() ).setPosition( pos );
1397 model()->childAlgorithm( output->childId() ).modelOutput( output->name() ).setSize( size );
1401bool QgsModelOutputGraphicItem::canDeleteComponent()
1403 if (
dynamic_cast<const QgsProcessingModelOutput *
>( component() ) )
1410void QgsModelOutputGraphicItem::deleteComponent()
1412 if (
const QgsProcessingModelOutput *output =
dynamic_cast<const QgsProcessingModelOutput *
>( component() ) )
1414 emit aboutToChange( tr(
"Delete Output %1" ).arg( output->description() ) );
1415 model()->childAlgorithm( output->childId() ).removeModelOutput( output->name() );
1416 model()->updateDestinationParameters();
1418 emit requestModelRepaint();
1427QgsModelGroupBoxGraphicItem::QgsModelGroupBoxGraphicItem( QgsProcessingModelGroupBox *box, QgsProcessingModelAlgorithm *model, QGraphicsItem *parent )
1428 : QgsModelComponentGraphicItem( box, model, parent )
1430 setZValue( QgsModelGraphicsScene::ZValues::GroupBox );
1431 setLabel( box->description() );
1435 f.setPixelSize( 14 );
1439void QgsModelGroupBoxGraphicItem::contextMenuEvent( QGraphicsSceneContextMenuEvent *event )
1441 QMenu *popupmenu =
new QMenu( event->widget() );
1442 QAction *removeAction = popupmenu->addAction( QObject::tr(
"Remove" ) );
1443 connect( removeAction, &QAction::triggered,
this, &QgsModelGroupBoxGraphicItem::deleteComponent );
1444 QAction *editAction = popupmenu->addAction( QObject::tr(
"Edit…" ) );
1445 connect( editAction, &QAction::triggered,
this, &QgsModelGroupBoxGraphicItem::editComponent );
1446 popupmenu->exec( event->screenPos() );
1449QgsModelGroupBoxGraphicItem::~QgsModelGroupBoxGraphicItem() =
default;
1451QColor QgsModelGroupBoxGraphicItem::fillColor( QgsModelComponentGraphicItem::State state )
const
1453 QColor
c( 230, 230, 230 );
1457 c =
c.darker( 110 );
1460 c =
c.darker( 105 );
1469QColor QgsModelGroupBoxGraphicItem::strokeColor( QgsModelComponentGraphicItem::State state )
const
1474 return QColor( 50, 50, 50 );
1477 return QColor( 150, 150, 150 );
1482QColor QgsModelGroupBoxGraphicItem::textColor( QgsModelComponentGraphicItem::State )
const
1484 return QColor( 100, 100, 100 );
1487Qt::PenStyle QgsModelGroupBoxGraphicItem::strokeStyle( QgsModelComponentGraphicItem::State )
const
1492Qt::Alignment QgsModelGroupBoxGraphicItem::titleAlignment()
const
1494 return Qt::AlignHCenter;
1497void QgsModelGroupBoxGraphicItem::updateStoredComponentPosition(
const QPointF &pos,
const QSizeF &size )
1499 if ( QgsProcessingModelGroupBox *box =
dynamic_cast<QgsProcessingModelGroupBox *
>( component() ) )
1501 box->setPosition( pos );
1502 box->setSize( size );
1503 model()->addGroupBox( *box );
1507bool QgsModelGroupBoxGraphicItem::canDeleteComponent()
1509 if (
dynamic_cast<QgsProcessingModelGroupBox *
>( component() ) )
1516void QgsModelGroupBoxGraphicItem::deleteComponent()
1518 if (
const QgsProcessingModelGroupBox *box =
dynamic_cast<const QgsProcessingModelGroupBox *
>( component() ) )
1520 emit aboutToChange( tr(
"Delete Group Box" ) );
1521 model()->removeGroupBox( box->uuid() );
1523 emit requestModelRepaint();
1527void QgsModelGroupBoxGraphicItem::editComponent()
1529 if (
const QgsProcessingModelGroupBox *box =
dynamic_cast<const QgsProcessingModelGroupBox *
>( component() ) )
1535 emit aboutToChange( tr(
"Edit Group Box" ) );
1536 model()->addGroupBox( dlg.groupBox() );
1538 emit requestModelRepaint();
1547QgsModelCommentGraphicItem::QgsModelCommentGraphicItem( QgsProcessingModelComment *comment, QgsModelComponentGraphicItem *parentItem, QgsProcessingModelAlgorithm *model, QGraphicsItem *parent )
1548 : QgsModelComponentGraphicItem( comment, model, parent )
1549 , mParentComponent( parentItem->component()->clone() )
1550 , mParentItem( parentItem )
1552 setLabel( comment->description() );
1555 f.setPixelSize( 9 );
1559void QgsModelCommentGraphicItem::contextMenuEvent( QGraphicsSceneContextMenuEvent *event )
1561 QMenu *popupmenu =
new QMenu( event->widget() );
1562 QAction *removeAction = popupmenu->addAction( QObject::tr(
"Remove" ) );
1563 connect( removeAction, &QAction::triggered,
this, &QgsModelCommentGraphicItem::deleteComponent );
1564 QAction *editAction = popupmenu->addAction( QObject::tr(
"Edit…" ) );
1565 connect( editAction, &QAction::triggered,
this, &QgsModelCommentGraphicItem::editComponent );
1566 popupmenu->exec( event->screenPos() );
1569QgsModelCommentGraphicItem::~QgsModelCommentGraphicItem() =
default;
1571QColor QgsModelCommentGraphicItem::fillColor( QgsModelComponentGraphicItem::State state )
const
1573 QColor
c( 230, 230, 230 );
1577 c =
c.darker( 110 );
1580 c =
c.darker( 105 );
1589QColor QgsModelCommentGraphicItem::strokeColor( QgsModelComponentGraphicItem::State state )
const
1594 return QColor( 50, 50, 50 );
1597 return QColor( 150, 150, 150 );
1602QColor QgsModelCommentGraphicItem::textColor( QgsModelComponentGraphicItem::State )
const
1604 return QColor( 100, 100, 100 );
1607Qt::PenStyle QgsModelCommentGraphicItem::strokeStyle( QgsModelComponentGraphicItem::State )
const
1612void QgsModelCommentGraphicItem::updateStoredComponentPosition(
const QPointF &pos,
const QSizeF &size )
1614 if ( QgsProcessingModelComment *comment = modelComponent() )
1616 comment->setPosition( pos );
1617 comment->setSize( size );
1621bool QgsModelCommentGraphicItem::canDeleteComponent()
1623 if ( modelComponent() )
1630void QgsModelCommentGraphicItem::deleteComponent()
1632 if ( QgsProcessingModelComment *comment = modelComponent() )
1634 emit aboutToChange( tr(
"Delete Comment" ) );
1635 comment->setDescription( QString() );
1637 emit requestModelRepaint();
1641void QgsModelCommentGraphicItem::editComponent()
1645 mParentItem->editComment();
1649QgsProcessingModelComment *QgsModelCommentGraphicItem::modelComponent()
1651 if (
const QgsProcessingModelChildAlgorithm *child =
dynamic_cast<const QgsProcessingModelChildAlgorithm *
>( mParentComponent.get() ) )
1653 return model()->childAlgorithm( child->childId() ).comment();
1655 else if (
const QgsProcessingModelParameter *param =
dynamic_cast<const QgsProcessingModelParameter *
>( mParentComponent.get() ) )
1657 return model()->parameterComponent( param->parameterName() ).comment();
1659 else if (
const QgsProcessingModelOutput *output =
dynamic_cast<const QgsProcessingModelOutput *
>( mParentComponent.get() ) )
1661 return model()->childAlgorithm( output->childId() ).modelOutput( output->name() ).comment();
1666QgsModelComponentGraphicItem *QgsModelCommentGraphicItem::parentComponentItem()
const
@ Success
Child was successfully executed.
@ NotExecuted
Child has not been executed.
@ Failed
Child encountered an error while executing.
@ 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.
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
static QString iconPath(const QString &iconFile)
Returns path to the desired icon file.
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())
Adds a message to the log instance (and creates it if necessary).
A widget which allows users to specify the properties of a model group box.
A mouse event which is the result of a user interaction with a QgsModelGraphicsView.
QPointF modelPoint() const
Returns the event point location in model coordinates.
Abstract base class for processing algorithms.
Encapsulates the results of running a child algorithm within a model.
Base class for the definition of processing outputs.
QString description() const
Returns the description for the output.
Base class for the definition of processing parameters.
virtual QString userFriendlyString(const QVariant &value) const
Returns a user-friendly string representation of the provided parameter value.
QString description() const
Returns the description for the parameter.
QString name() const
Returns the name of the parameter.
A rectangle specified with double values.
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
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
QList< const QgsProcessingParameterDefinition * > QgsProcessingParameterDefinitions
List of processing parameters.