1/************************************************************************ 2 * This file has been generated automatically from * 3 * * 4 * src/gui/processing/models/qgsmodelcomponentgraphicitem.h * 5 * * 6 * Do not edit manually ! Edit header and run scripts/sipify.pl again * 7 ************************************************************************/ 8 9 10 11 12 13class QgsModelComponentGraphicItem : QGraphicsObject 14{ 15%Docstring 16Base class for graphic items representing model components in the model designer. 17 18.. warning:: 19 20 Not stable API 21 22.. versionadded:: 3.14 23%End 24 25%TypeHeaderCode 26#include "qgsmodelcomponentgraphicitem.h" 27%End 28 public: 29 30 enum State 31 { 32 Normal, 33 Selected, 34 Hover, 35 }; 36 37 enum Flag 38 { 39 // For future API flexibility only and to avoid sip issues, remove when real entries are added to flags. 40 Unused, 41 }; 42 typedef QFlags<QgsModelComponentGraphicItem::Flag> Flags; 43 44 45 QgsModelComponentGraphicItem( QgsProcessingModelComponent *component /Transfer/, 46 QgsProcessingModelAlgorithm *model, 47 QGraphicsItem *parent /TransferThis/ ); 48%Docstring 49Constructor for QgsModelComponentGraphicItem for the specified ``component``, with the specified ``parent`` item. 50 51The ``model`` argument specifies the associated processing model. Ownership of ``model`` is not transferred, and 52it must exist for the lifetime of this object. 53 54Ownership of ``component`` is transferred to the item. 55%End 56 57 ~QgsModelComponentGraphicItem(); 58 59 virtual Flags flags() const; 60%Docstring 61Returns item flags. 62%End 63 64 QgsProcessingModelComponent *component(); 65%Docstring 66Returns the model component associated with this item. 67%End 68 69 70 QgsProcessingModelAlgorithm *model(); 71%Docstring 72Returns the model associated with this item. 73%End 74 75 QgsModelGraphicsView *view(); 76%Docstring 77Returns the associated view. 78%End 79 80 QFont font() const; 81%Docstring 82Returns the font used to render text in the item. 83 84.. seealso:: :py:func:`setFont` 85%End 86 87 void setFont( const QFont &font ); 88%Docstring 89Sets the ``font`` used to render text in the item. 90 91.. seealso:: :py:func:`font` 92%End 93 94 void moveComponentBy( qreal dx, qreal dy ); 95%Docstring 96Moves the component by the specified ``dx`` and ``dy``. 97 98.. warning:: 99 100 Call this method, not QGraphicsItem.moveBy! 101%End 102 103 void previewItemMove( qreal dx, qreal dy ); 104%Docstring 105Shows a preview of moving the item from its stored position by ``dx``, ``dy``. 106%End 107 108 void setItemRect( QRectF rect ); 109%Docstring 110Sets a new scene ``rect`` for the item. 111%End 112 113 virtual void mouseDoubleClickEvent( QGraphicsSceneMouseEvent *event ); 114 115 virtual void hoverEnterEvent( QGraphicsSceneHoverEvent *event ); 116 117 virtual void hoverMoveEvent( QGraphicsSceneHoverEvent *event ); 118 119 virtual void hoverLeaveEvent( QGraphicsSceneHoverEvent *event ); 120 121 virtual QVariant itemChange( GraphicsItemChange change, const QVariant &value ); 122 123 virtual QRectF boundingRect() const; 124 125 virtual bool contains( const QPointF &point ) const; 126 127 virtual void paint( QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0 ); 128 129 130 QRectF itemRect( bool storedRect = false ) const; 131%Docstring 132Returns the rectangle representing the body of the item. 133%End 134 135 QString label() const; 136%Docstring 137Returns the item's label text. 138 139.. seealso:: :py:func:`setLabel` 140%End 141 142 void setLabel( const QString &label ); 143%Docstring 144Returns the item's ``label`` text. 145 146.. seealso:: :py:func:`label` 147%End 148 149 State state() const; 150%Docstring 151Returns the item's current state. 152%End 153 154 virtual int linkPointCount( Qt::Edge edge ) const; 155%Docstring 156Returns the number of link points associated with the component on the specified ``edge``. 157%End 158 159 virtual QString linkPointText( Qt::Edge edge, int index ) const; 160%Docstring 161Returns the text to use for the link point with the specified ``index`` on the specified ``edge``. 162%End 163 164 QPointF linkPoint( Qt::Edge edge, int index, bool incoming ) const; 165%Docstring 166Returns the location of the link point with the specified ``index`` on the specified ``edge``. 167%End 168 169 QPointF calculateAutomaticLinkPoint( QgsModelComponentGraphicItem *other, Qt::Edge &edge /Out/ ) const; 170%Docstring 171Returns the best link point to use for a link originating at a specified ``other`` item. 172 173:param other: item at other end of link 174 175:return: - calculated link point in item coordinates. 176 - edge: item edge for calculated best link point 177%End 178 179 QPointF calculateAutomaticLinkPoint( const QPointF &point, Qt::Edge &edge /Out/ ) const; 180%Docstring 181Returns the best link point to use for a link originating at a specified ``other`` point. 182 183:param other: point for other end of link (in scene coordinates) 184 185:return: - calculated link point in item coordinates. 186 - edge: item edge for calculated best link point 187%End 188 189 virtual void editComment(); 190%Docstring 191Called when the comment attached to the item should be edited. 192 193The default implementation does nothing. 194%End 195 196 virtual bool canDeleteComponent(); 197%Docstring 198Returns ``True`` if the component can be deleted. 199%End 200 201 virtual void deleteComponent(); 202%Docstring 203Called when the component should be deleted. 204 205The default implementation does nothing. 206%End 207 208 signals: 209 210 211 void requestModelRepaint(); 212%Docstring 213Emitted by the item to request a repaint of the parent model scene. 214%End 215 216 void aboutToChange( const QString &text, int id = 0 ); 217%Docstring 218Emitted when the definition of the associated component is about to be changed 219by the item. 220 221The ``text`` argument gives the translated text describing the change about to occur, and the 222optional ``id`` can be used to group the associated undo commands. 223%End 224 225 void changed(); 226%Docstring 227Emitted when the definition of the associated component is changed 228by the item. 229%End 230 231 void repaintArrows(); 232%Docstring 233Emitted when item requests that all connected arrows are repainted. 234%End 235 236 void updateArrowPaths(); 237%Docstring 238Emitted when item requires that all connected arrow paths are recalculated. 239%End 240 241 void sizePositionChanged(); 242%Docstring 243Emitted when the item's size or position changes. 244%End 245 246 protected slots: 247 248 virtual void editComponent(); 249%Docstring 250Called when the component should be edited. 251 252The default implementation does nothing. 253%End 254 255 protected: 256 257 QString truncatedTextForItem( const QString &text ) const; 258%Docstring 259Truncates a ``text`` string so that it fits nicely within the item's width, 260accounting for margins and interactive buttons. 261%End 262 263 virtual QColor fillColor( State state ) const = 0; 264%Docstring 265Returns the fill color for the item for the specified ``state``. 266%End 267 268 virtual QColor strokeColor( State state ) const = 0; 269%Docstring 270Returns the stroke color for the item for the specified ``state``. 271%End 272 273 virtual QColor textColor( State state ) const = 0; 274%Docstring 275Returns the label text color for the item for the specified ``state``. 276%End 277 278 virtual Qt::PenStyle strokeStyle( State state ) const; 279%Docstring 280Returns the stroke style to use while rendering the outline of the item. 281%End 282 283 virtual Qt::Alignment titleAlignment() const; 284%Docstring 285Returns the title alignment 286%End 287 288 virtual QPicture iconPicture() const; 289%Docstring 290Returns a QPicture version of the item's icon, if available. 291%End 292 293 virtual QPixmap iconPixmap() const; 294%Docstring 295Returns a QPixmap version of the item's icon, if available. 296%End 297 298 virtual void updateStoredComponentPosition( const QPointF &pos, const QSizeF &size ) = 0; 299%Docstring 300Updates the position and size stored in the model for the associated comment 301%End 302 303 void updateButtonPositions(); 304%Docstring 305Updates the item's button positions, based on the current item rect. 306%End 307 308}; 309QFlags<QgsModelComponentGraphicItem::Flag> operator|(QgsModelComponentGraphicItem::Flag f1, QFlags<QgsModelComponentGraphicItem::Flag> f2); 310 311 312class QgsModelParameterGraphicItem : QgsModelComponentGraphicItem 313{ 314%Docstring 315A graphic item representing a model parameter (input) in the model designer. 316 317.. warning:: 318 319 Not stable API 320 321.. versionadded:: 3.14 322%End 323 324%TypeHeaderCode 325#include "qgsmodelcomponentgraphicitem.h" 326%End 327 public: 328 329 QgsModelParameterGraphicItem( QgsProcessingModelParameter *parameter /Transfer/, 330 QgsProcessingModelAlgorithm *model, 331 QGraphicsItem *parent /TransferThis/ ); 332%Docstring 333Constructor for QgsModelParameterGraphicItem for the specified ``parameter``, with the specified ``parent`` item. 334 335The ``model`` argument specifies the associated processing model. Ownership of ``model`` is not transferred, and 336it must exist for the lifetime of this object. 337 338Ownership of ``parameter`` is transferred to the item. 339%End 340 341 virtual void contextMenuEvent( QGraphicsSceneContextMenuEvent *event ); 342 343 virtual bool canDeleteComponent(); 344 345 346 protected: 347 348 virtual QColor fillColor( State state ) const; 349 350 virtual QColor strokeColor( State state ) const; 351 352 virtual QColor textColor( State state ) const; 353 354 virtual QPicture iconPicture() const; 355 356 virtual void updateStoredComponentPosition( const QPointF &pos, const QSizeF &size ); 357 358 359 protected slots: 360 361 virtual void deleteComponent(); 362 363 364}; 365 366class QgsModelChildAlgorithmGraphicItem : QgsModelComponentGraphicItem 367{ 368%Docstring 369A graphic item representing a child algorithm in the model designer. 370 371.. warning:: 372 373 Not stable API 374 375.. versionadded:: 3.14 376%End 377 378%TypeHeaderCode 379#include "qgsmodelcomponentgraphicitem.h" 380%End 381 public: 382 383 QgsModelChildAlgorithmGraphicItem( QgsProcessingModelChildAlgorithm *child /Transfer/, 384 QgsProcessingModelAlgorithm *model, 385 QGraphicsItem *parent /TransferThis/ ); 386%Docstring 387Constructor for QgsModelChildAlgorithmGraphicItem for the specified ``child``, with the specified ``parent`` item. 388 389The ``model`` argument specifies the associated processing model. Ownership of ``model`` is not transferred, and 390it must exist for the lifetime of this object. 391 392Ownership of ``child`` is transferred to the item. 393%End 394 virtual void contextMenuEvent( QGraphicsSceneContextMenuEvent *event ); 395 396 virtual bool canDeleteComponent(); 397 398 399 void setResults( const QVariantMap &results ); 400%Docstring 401Sets the results obtained for this child algorithm for the last model execution through the dialog. 402%End 403 404 void setInputs( const QVariantMap &inputs ); 405%Docstring 406Sets the inputs used for this child algorithm for the last model execution through the dialog. 407%End 408 409 protected: 410 411 virtual QColor fillColor( State state ) const; 412 413 virtual QColor strokeColor( State state ) const; 414 415 virtual QColor textColor( State state ) const; 416 417 virtual QPixmap iconPixmap() const; 418 419 virtual QPicture iconPicture() const; 420 421 422 virtual int linkPointCount( Qt::Edge edge ) const; 423 424 virtual QString linkPointText( Qt::Edge edge, int index ) const; 425 426 virtual void updateStoredComponentPosition( const QPointF &pos, const QSizeF &size ); 427 428 429 protected slots: 430 431 virtual void deleteComponent(); 432 433 434}; 435 436 437class QgsModelOutputGraphicItem : QgsModelComponentGraphicItem 438{ 439%Docstring 440A graphic item representing a model output in the model designer. 441 442.. warning:: 443 444 Not stable API 445 446.. versionadded:: 3.14 447%End 448 449%TypeHeaderCode 450#include "qgsmodelcomponentgraphicitem.h" 451%End 452 public: 453 454 QgsModelOutputGraphicItem( QgsProcessingModelOutput *output /Transfer/, 455 QgsProcessingModelAlgorithm *model, 456 QGraphicsItem *parent /TransferThis/ ); 457%Docstring 458Constructor for QgsModelOutputGraphicItem for the specified ``output``, with the specified ``parent`` item. 459 460The ``model`` argument specifies the associated processing model. Ownership of ``model`` is not transferred, and 461it must exist for the lifetime of this object. 462 463Ownership of ``output`` is transferred to the item. 464%End 465 466 virtual bool canDeleteComponent(); 467 468 469 protected: 470 471 virtual QColor fillColor( State state ) const; 472 473 virtual QColor strokeColor( State state ) const; 474 475 virtual QColor textColor( State state ) const; 476 477 virtual QPicture iconPicture() const; 478 479 virtual void updateStoredComponentPosition( const QPointF &pos, const QSizeF &size ); 480 481 482 protected slots: 483 484 virtual void deleteComponent(); 485 486 487}; 488 489 490 491class QgsModelCommentGraphicItem : QgsModelComponentGraphicItem 492{ 493%Docstring 494A graphic item representing a model comment in the model designer. 495 496.. warning:: 497 498 Not stable API 499 500.. versionadded:: 3.14 501%End 502 503%TypeHeaderCode 504#include "qgsmodelcomponentgraphicitem.h" 505%End 506 public: 507 508 QgsModelCommentGraphicItem( QgsProcessingModelComment *comment /Transfer/, 509 QgsModelComponentGraphicItem *parentItem, 510 QgsProcessingModelAlgorithm *model, 511 QGraphicsItem *parent /TransferThis/ ); 512%Docstring 513Constructor for QgsModelCommentGraphicItem for the specified ``comment``, with the specified ``parent`` item. 514 515The ``model`` argument specifies the associated processing model. Ownership of ``model`` is not transferred, and 516it must exist for the lifetime of this object. 517 518Ownership of ``output`` is transferred to the item. 519%End 520 ~QgsModelCommentGraphicItem(); 521 virtual void contextMenuEvent( QGraphicsSceneContextMenuEvent *event ); 522 523 virtual bool canDeleteComponent(); 524 525 526 QgsModelComponentGraphicItem *parentComponentItem() const; 527%Docstring 528Returns the parent model component item. 529%End 530 531 protected: 532 533 virtual QColor fillColor( State state ) const; 534 535 virtual QColor strokeColor( State state ) const; 536 537 virtual QColor textColor( State state ) const; 538 539 virtual Qt::PenStyle strokeStyle( State state ) const; 540 541 virtual void updateStoredComponentPosition( const QPointF &pos, const QSizeF &size ); 542 543 544 protected slots: 545 546 virtual void deleteComponent(); 547 548 virtual void editComponent(); 549 550}; 551 552 553class QgsModelGroupBoxGraphicItem : QgsModelComponentGraphicItem 554{ 555%Docstring 556A graphic item representing a group box in the model designer. 557 558.. warning:: 559 560 Not stable API 561 562.. versionadded:: 3.14 563%End 564 565%TypeHeaderCode 566#include "qgsmodelcomponentgraphicitem.h" 567%End 568 public: 569 570 QgsModelGroupBoxGraphicItem( QgsProcessingModelGroupBox *box /Transfer/, 571 QgsProcessingModelAlgorithm *model, 572 QGraphicsItem *parent /TransferThis/ ); 573%Docstring 574Constructor for QgsModelGroupBoxGraphicItem for the specified group ``box``, with the specified ``parent`` item. 575 576The ``model`` argument specifies the associated processing model. Ownership of ``model`` is not transferred, and 577it must exist for the lifetime of this object. 578 579Ownership of ``output`` is transferred to the item. 580%End 581 ~QgsModelGroupBoxGraphicItem(); 582 virtual void contextMenuEvent( QGraphicsSceneContextMenuEvent *event ); 583 584 virtual bool canDeleteComponent(); 585 586 protected: 587 588 virtual QColor fillColor( State state ) const; 589 590 virtual QColor strokeColor( State state ) const; 591 592 virtual QColor textColor( State state ) const; 593 594 virtual Qt::PenStyle strokeStyle( State state ) const; 595 596 virtual Qt::Alignment titleAlignment() const; 597 598 virtual void updateStoredComponentPosition( const QPointF &pos, const QSizeF &size ); 599 600 601 protected slots: 602 603 virtual void deleteComponent(); 604 605 virtual void editComponent(); 606 607}; 608 609 610/************************************************************************ 611 * This file has been generated automatically from * 612 * * 613 * src/gui/processing/models/qgsmodelcomponentgraphicitem.h * 614 * * 615 * Do not edit manually ! Edit header and run scripts/sipify.pl again * 616 ************************************************************************/ 617