diff --git a/python/PyQt6/gui/auto_additions/qgsmodelcomponentgraphicitem.py b/python/PyQt6/gui/auto_additions/qgsmodelcomponentgraphicitem.py index 9055186f952..9d267daba7d 100644 --- a/python/PyQt6/gui/auto_additions/qgsmodelcomponentgraphicitem.py +++ b/python/PyQt6/gui/auto_additions/qgsmodelcomponentgraphicitem.py @@ -16,7 +16,7 @@ QgsModelComponentGraphicItem.Flag.__and__ = lambda flag1, flag2: _force_int(flag QgsModelComponentGraphicItem.Flag.__or__ = lambda flag1, flag2: QgsModelComponentGraphicItem.Flag(_force_int(flag1) | _force_int(flag2)) try: QgsModelComponentGraphicItem.__attribute_docs__ = {'requestModelRepaint': 'Emitted by the item to request a repaint of the parent model scene.\n', 'aboutToChange': 'Emitted when the definition of the associated component is about to be\nchanged by the item.\n\nThe ``text`` argument gives the translated text describing the change\nabout to occur, and the optional ``id`` can be used to group the\nassociated undo commands.\n', 'changed': 'Emitted when the definition of the associated component is changed by\nthe item.\n', 'repaintArrows': 'Emitted when item requests that all connected arrows are repainted.\n', 'updateArrowPaths': 'Emitted when item requires that all connected arrow paths are\nrecalculated.\n', 'sizePositionChanged': "Emitted when the item's size or position changes.\n"} - QgsModelComponentGraphicItem.__virtual_methods__ = ['flags', 'linkPointCount', 'linkPointText', 'editComment', 'canDeleteComponent', 'deleteComponent', 'editComponent', 'strokeStyle', 'titleAlignment', 'iconPicture', 'iconPixmap'] + QgsModelComponentGraphicItem.__virtual_methods__ = ['flags', 'getLinkedParamDataType', 'linkPointCount', 'linkPointText', 'editComment', 'canDeleteComponent', 'deleteComponent', 'editComponent', 'strokeStyle', 'titleAlignment', 'iconPicture', 'iconPixmap'] QgsModelComponentGraphicItem.__abstract_methods__ = ['fillColor', 'strokeColor', 'textColor', 'updateStoredComponentPosition'] QgsModelComponentGraphicItem.__overridden_methods__ = ['mouseDoubleClickEvent', 'hoverEnterEvent', 'hoverMoveEvent', 'hoverLeaveEvent', 'itemChange', 'boundingRect', 'contains', 'paint'] QgsModelComponentGraphicItem.__signal_arguments__ = {'aboutToChange': ['text: str', 'id: int = 0']} @@ -30,7 +30,7 @@ try: except (NameError, AttributeError): pass try: - QgsModelParameterGraphicItem.__overridden_methods__ = ['contextMenuEvent', 'canDeleteComponent', 'fillColor', 'strokeColor', 'textColor', 'iconPicture', 'linkPointCount', 'linkPointText', 'updateStoredComponentPosition', 'deleteComponent'] + QgsModelParameterGraphicItem.__overridden_methods__ = ['contextMenuEvent', 'canDeleteComponent', 'getLinkedParamDataType', 'fillColor', 'strokeColor', 'textColor', 'iconPicture', 'linkPointCount', 'linkPointText', 'updateStoredComponentPosition', 'deleteComponent'] QgsModelParameterGraphicItem.__group__ = ['processing', 'models'] except (NameError, AttributeError): pass diff --git a/python/PyQt6/gui/auto_generated/processing/models/qgsmodelcomponentgraphicitem.sip.in b/python/PyQt6/gui/auto_generated/processing/models/qgsmodelcomponentgraphicitem.sip.in index d0ad7a3d7ec..1fe08199f3c 100644 --- a/python/PyQt6/gui/auto_generated/processing/models/qgsmodelcomponentgraphicitem.sip.in +++ b/python/PyQt6/gui/auto_generated/processing/models/qgsmodelcomponentgraphicitem.sip.in @@ -112,7 +112,7 @@ Shows a preview of moving the item from its stored position by ``dx``, Sets a new scene ``rect`` for the item. %End - QString getLinkedParamDataType( Qt::Edge edge, int index ); + virtual QString getLinkedParamDataType( Qt::Edge edge, int index ); virtual void mouseDoubleClickEvent( QGraphicsSceneMouseEvent *event ); @@ -364,7 +364,8 @@ Ownership of ``parameter`` is transferred to the item. virtual bool canDeleteComponent(); - QString getLinkedParamDataType( Qt::Edge edge, int index ); + virtual QString getLinkedParamDataType( Qt::Edge /* unused in this implementation because parameters only have a bottom edge */, int index ); + protected: virtual QColor fillColor( State state ) const; diff --git a/python/gui/auto_additions/qgsmodelcomponentgraphicitem.py b/python/gui/auto_additions/qgsmodelcomponentgraphicitem.py index c6c7013495b..0a1e16ee20d 100644 --- a/python/gui/auto_additions/qgsmodelcomponentgraphicitem.py +++ b/python/gui/auto_additions/qgsmodelcomponentgraphicitem.py @@ -1,7 +1,7 @@ # The following has been generated automatically from src/gui/processing/models/qgsmodelcomponentgraphicitem.h try: QgsModelComponentGraphicItem.__attribute_docs__ = {'requestModelRepaint': 'Emitted by the item to request a repaint of the parent model scene.\n', 'aboutToChange': 'Emitted when the definition of the associated component is about to be\nchanged by the item.\n\nThe ``text`` argument gives the translated text describing the change\nabout to occur, and the optional ``id`` can be used to group the\nassociated undo commands.\n', 'changed': 'Emitted when the definition of the associated component is changed by\nthe item.\n', 'repaintArrows': 'Emitted when item requests that all connected arrows are repainted.\n', 'updateArrowPaths': 'Emitted when item requires that all connected arrow paths are\nrecalculated.\n', 'sizePositionChanged': "Emitted when the item's size or position changes.\n"} - QgsModelComponentGraphicItem.__virtual_methods__ = ['flags', 'linkPointCount', 'linkPointText', 'editComment', 'canDeleteComponent', 'deleteComponent', 'editComponent', 'strokeStyle', 'titleAlignment', 'iconPicture', 'iconPixmap'] + QgsModelComponentGraphicItem.__virtual_methods__ = ['flags', 'getLinkedParamDataType', 'linkPointCount', 'linkPointText', 'editComment', 'canDeleteComponent', 'deleteComponent', 'editComponent', 'strokeStyle', 'titleAlignment', 'iconPicture', 'iconPixmap'] QgsModelComponentGraphicItem.__abstract_methods__ = ['fillColor', 'strokeColor', 'textColor', 'updateStoredComponentPosition'] QgsModelComponentGraphicItem.__overridden_methods__ = ['mouseDoubleClickEvent', 'hoverEnterEvent', 'hoverMoveEvent', 'hoverLeaveEvent', 'itemChange', 'boundingRect', 'contains', 'paint'] QgsModelComponentGraphicItem.__signal_arguments__ = {'aboutToChange': ['text: str', 'id: int = 0']} @@ -15,7 +15,7 @@ try: except (NameError, AttributeError): pass try: - QgsModelParameterGraphicItem.__overridden_methods__ = ['contextMenuEvent', 'canDeleteComponent', 'fillColor', 'strokeColor', 'textColor', 'iconPicture', 'linkPointCount', 'linkPointText', 'updateStoredComponentPosition', 'deleteComponent'] + QgsModelParameterGraphicItem.__overridden_methods__ = ['contextMenuEvent', 'canDeleteComponent', 'getLinkedParamDataType', 'fillColor', 'strokeColor', 'textColor', 'iconPicture', 'linkPointCount', 'linkPointText', 'updateStoredComponentPosition', 'deleteComponent'] QgsModelParameterGraphicItem.__group__ = ['processing', 'models'] except (NameError, AttributeError): pass diff --git a/python/gui/auto_generated/processing/models/qgsmodelcomponentgraphicitem.sip.in b/python/gui/auto_generated/processing/models/qgsmodelcomponentgraphicitem.sip.in index 893c8baa8ae..f243eb816e8 100644 --- a/python/gui/auto_generated/processing/models/qgsmodelcomponentgraphicitem.sip.in +++ b/python/gui/auto_generated/processing/models/qgsmodelcomponentgraphicitem.sip.in @@ -112,7 +112,7 @@ Shows a preview of moving the item from its stored position by ``dx``, Sets a new scene ``rect`` for the item. %End - QString getLinkedParamDataType( Qt::Edge edge, int index ); + virtual QString getLinkedParamDataType( Qt::Edge edge, int index ); virtual void mouseDoubleClickEvent( QGraphicsSceneMouseEvent *event ); @@ -364,7 +364,8 @@ Ownership of ``parameter`` is transferred to the item. virtual bool canDeleteComponent(); - QString getLinkedParamDataType( Qt::Edge edge, int index ); + virtual QString getLinkedParamDataType( Qt::Edge /* unused in this implementation because parameters only have a bottom edge */, int index ); + protected: virtual QColor fillColor( State state ) const; diff --git a/src/gui/processing/models/qgsmodelarrowitem.cpp b/src/gui/processing/models/qgsmodelarrowitem.cpp index ad1d52545b9..8c7c9727306 100644 --- a/src/gui/processing/models/qgsmodelarrowitem.cpp +++ b/src/gui/processing/models/qgsmodelarrowitem.cpp @@ -73,19 +73,7 @@ QgsModelArrowItem::QgsModelArrowItem( QgsModelComponentGraphicItem *startItem, M void QgsModelArrowItem::paint( QPainter *painter, const QStyleOptionGraphicsItem *, QWidget * ) { - QString dataType; - - // Possibly, the mComponentItem is an instance of QgsModelParameterGraphicItem. In this case, - // it needs to be explicitely casted so that the relevant getLinkedParamDataType method is being called - if ( QgsModelParameterGraphicItem *paramItem = dynamic_cast( mStartItem ) ) - { - dataType = paramItem->getLinkedParamDataType( mStartEdge, mStartIndex ); - } - else - { - dataType = mStartItem->getLinkedParamDataType( mStartEdge, mStartIndex ); - } - + QString dataType = mStartItem->getLinkedParamDataType( mStartEdge, mStartIndex ); QColor color = QgsModelDesignerSocketGraphicItem::typeToColorLookup( dataType ); if ( mStartItem->state() == QgsModelComponentGraphicItem::Selected || mEndItem->state() == QgsModelComponentGraphicItem::Selected ) diff --git a/src/gui/processing/models/qgsmodelcomponentgraphicitem.cpp b/src/gui/processing/models/qgsmodelcomponentgraphicitem.cpp index 82a6845cda1..3cd59410ea5 100644 --- a/src/gui/processing/models/qgsmodelcomponentgraphicitem.cpp +++ b/src/gui/processing/models/qgsmodelcomponentgraphicitem.cpp @@ -888,7 +888,7 @@ QString QgsModelParameterGraphicItem::linkPointText( Qt::Edge, int index ) const } -QString QgsModelParameterGraphicItem::getLinkedParamDataType( Qt::Edge edge, int index ) +QString QgsModelParameterGraphicItem::getLinkedParamDataType( Qt::Edge /* unused in this implementation because parameters only have a bottom edge */, int index ) { QString unknownType = QString( "unknown" ); diff --git a/src/gui/processing/models/qgsmodelcomponentgraphicitem.h b/src/gui/processing/models/qgsmodelcomponentgraphicitem.h index 32e900eaa24..f01e0e26a0b 100644 --- a/src/gui/processing/models/qgsmodelcomponentgraphicitem.h +++ b/src/gui/processing/models/qgsmodelcomponentgraphicitem.h @@ -137,7 +137,7 @@ class GUI_EXPORT QgsModelComponentGraphicItem : public QGraphicsObject */ void setItemRect( QRectF rect ); - QString getLinkedParamDataType( Qt::Edge edge, int index ); + virtual QString getLinkedParamDataType( Qt::Edge edge, int index ); #ifndef SIP_RUN @@ -429,7 +429,7 @@ class GUI_EXPORT QgsModelParameterGraphicItem : public QgsModelComponentGraphicI void contextMenuEvent( QGraphicsSceneContextMenuEvent *event ) override; bool canDeleteComponent() override; - QString getLinkedParamDataType( Qt::Edge edge, int index ); + QString getLinkedParamDataType( Qt::Edge /* unused in this implementation because parameters only have a bottom edge */, int index ) override; protected: QColor fillColor( State state ) const override;