16 #ifndef QGSMODELGRAPHICSCENE_H
17 #define QGSMODELGRAPHICSCENE_H
22 #include <QGraphicsScene>
24 class QgsProcessingModelAlgorithm;
25 class QgsModelComponentGraphicItem;
26 class QgsProcessingModelParameter;
27 class QgsProcessingModelChildAlgorithm;
28 class QgsProcessingModelOutput;
29 class QgsProcessingModelComponent;
30 class QgsProcessingModelComment;
31 class QgsModelChildAlgorithmGraphicItem;
32 class QgsProcessingModelGroupBox;
43 class GUI_EXPORT QgsModelGraphicsScene :
public QGraphicsScene
64 FlagHideControls = 1 << 1,
65 FlagHideComments = 1 << 2,
67 Q_DECLARE_FLAGS( Flags, Flag )
74 QgsProcessingModelAlgorithm *model();
76 void setModel( QgsProcessingModelAlgorithm *model );
83 void setFlags( QgsModelGraphicsScene::Flags flags ) { mFlags = flags; }
91 void setFlag( QgsModelGraphicsScene::Flag flag,
bool on =
true );
98 QgsModelGraphicsScene::Flags flags()
const {
return mFlags; }
100 void mousePressEvent( QGraphicsSceneMouseEvent *event )
override;
110 QList<QgsModelComponentGraphicItem *> selectedComponentItems();
115 QgsModelComponentGraphicItem *componentItemAt( QPointF position )
const;
120 QgsModelComponentGraphicItem *groupBoxItem(
const QString &uuid );
138 void setSelectedItem( QgsModelComponentGraphicItem *item );
143 void setChildAlgorithmResults(
const QVariantMap &results );
148 void setChildAlgorithmInputs(
const QVariantMap &inputs );
174 void rebuildRequired();
182 void componentAboutToChange(
const QString &text,
int id = 0 );
187 void componentChanged();
193 void selectedItemChanged( QgsModelComponentGraphicItem *selected );
200 virtual QgsModelComponentGraphicItem *createParameterGraphicItem( QgsProcessingModelAlgorithm *model, QgsProcessingModelParameter *param )
const SIP_FACTORY;
205 virtual QgsModelChildAlgorithmGraphicItem *createChildAlgGraphicItem( QgsProcessingModelAlgorithm *model, QgsProcessingModelChildAlgorithm *child )
const SIP_FACTORY;
210 virtual QgsModelComponentGraphicItem *createOutputGraphicItem( QgsProcessingModelAlgorithm *model, QgsProcessingModelOutput *output )
const SIP_FACTORY;
215 virtual QgsModelComponentGraphicItem *createCommentGraphicItem( QgsProcessingModelAlgorithm *model, QgsProcessingModelComment *comment,
216 QgsModelComponentGraphicItem *parentItem )
const SIP_FACTORY;
221 QgsModelComponentGraphicItem *createGroupBoxGraphicItem( QgsProcessingModelAlgorithm *model, QgsProcessingModelGroupBox *box )
const SIP_FACTORY;
227 QgsModelComponentGraphicItem *item =
nullptr;
228 Qt::Edge edge = Qt::LeftEdge;
231 QList< LinkSource > linkSourcesForParameterValue( QgsProcessingModelAlgorithm *model,
const QVariant &value,
const QString &childId,
QgsProcessingContext &context )
const;
233 void addCommentItemForComponent( QgsProcessingModelAlgorithm *model,
const QgsProcessingModelComponent &component, QgsModelComponentGraphicItem *parentItem );
235 Flags mFlags = Flags();
237 QgsProcessingModelAlgorithm *mModel =
nullptr;
239 QMap< QString, QgsModelComponentGraphicItem * > mParameterItems;
240 QMap< QString, QgsModelChildAlgorithmGraphicItem * > mChildAlgorithmItems;
241 QMap< QString, QMap< QString, QgsModelComponentGraphicItem * > > mOutputItems;
242 QMap< QString, QgsModelComponentGraphicItem * > mGroupBoxItems;
243 QVariantMap mChildResults;
244 QVariantMap mChildInputs;
254 #endif // QGSMODELCOMPONENTGRAPHICITEM_H