X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/abbc64cf04a35ab3549d5c516f44c7c5921baa63..107509468a60f3e9e698d82a2575b700d9dde07e:/AbstractBoxItem.h diff --git a/AbstractBoxItem.h b/AbstractBoxItem.h index 6eeb46c..98cec58 100644 --- a/AbstractBoxItem.h +++ b/AbstractBoxItem.h @@ -22,6 +22,7 @@ public: enum ChangeType { Resize = 0, InterfaceMove }; AbstractBoxItem(AbstractBlock *_refBlock, Dispatcher *_dispatcher, Parameters *_params, QGraphicsItem* parent = Q_NULLPTR); + AbstractBoxItem(Dispatcher *_dispatcher, Parameters *_params, QGraphicsItem* parent = Q_NULLPTR); virtual ~AbstractBoxItem(); @@ -40,7 +41,8 @@ public: inline QPointF getOriginPoint() { return originPoint; } // setters - inline void setId(int id){ this->id = id; } + void setRefBlock(AbstractBlock* _refBlock); + inline void setId(int _id){ id = _id; } inline void setSelected(bool _selected) { selected = _selected; } inline void setRstClkVisible(bool b){ rstClkVisible = b;} void setDimension(int x, int y); @@ -58,7 +60,28 @@ public: void addInterface(InterfaceItem* i, bool resetPosition = false); void removeInterface(InterfaceItem* i); void resetInterfacesPosition(); - void deplaceInterface(QPointF pos); + /*! + * \brief moveInterfaceTo + * \param pos the new position (in scene) of the interface + * + * This method is called when user moves an InterfaceItem. + * see BoxItem::mouseMoveEvent() and GroupItem::mouseMoveEvent() + */ + void moveInterfaceTo(QPointF pos); + /*! + * \brief updateInterfacesAndConnections + * + * This method allows to recompute the absolute position of the interfaces of this box + * taking into account their relative position (see positionRatio atribute) in the width/height + * of the box border they are located on. It allows update the shape of all ConnectionItem + * connected to this box. + * + * CAUTION: this method supposes that before its call, a call to prepareGeometryChange() hase been + * done for the BoxItem that owns this InterfaceItem, so that the scene will readraw automatically + * the BoxItem. For the connections, the call to prepareGeometryChange() is done within setPath() + * that is called in this method. Thus, there is no need to call update() after the termination of + * this method. + */ void updateInterfacesAndConnections(); InterfaceItem *searchInterfaceByName(QString name);