1 #ifndef __BLOCKITEM_H__
2 #define __BLOCKITEM_H__
10 #include "AbstractBoxItem.h"
11 class AbstractBoxItem;
17 #include "Exception.h"
24 A BoxItem may represent a functional block or a group block within a group item, itslef
25 within a scene. What says what it represents is refBlock, i.e. if refBlock->isFunctionalBlock()
26 or refBlock->isGroupBlock() returns true.
28 class BoxItem : public AbstractBoxItem {
31 BoxItem(AbstractBlock *_refBlock, Dispatcher *_dispatcher, Parameters *_params, GroupItem* parent) throw(Exception);
34 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
37 inline GroupItem *getChildGroupItem() { return childGroupItem; }
40 inline void setChildGroupItem(GroupItem* item) { childGroupItem = item; }
46 void moveTo(QPointF dest);
47 void save(QXmlStreamWriter& writer);
51 void updateMinimumSize(); // modify the minimum size
52 bool updateGeometry(ChangeType type); // modify the originPoint and the total dimension
54 void mousePressEvent(QGraphicsSceneMouseEvent *event);
55 void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
56 void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
57 void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
58 void hoverMoveEvent( QGraphicsSceneHoverEvent *event);
63 A BlockItem is always graphically within a GroupItem, inside the same scene.
65 A BlockItem may also be the graphical view of a GroupBlock. In this case, there exists a child scene
66 containing a GroupItem. insideGroup atribute refers to this GroupItem and thus, may be NULL if the current
67 blockItem represents a functional block
69 GroupItem *childGroupItem;
72 friend QDataStream &operator<<(QDataStream &out, BoxItem &b);
73 friend QDataStream &operator>>(QDataStream &in, BoxItem &b);
76 void itemMustBeDeleted(QGraphicsItem*);
80 QDataStream & operator <<(QDataStream &out, BoxItem &b);
81 QDataStream & operator >>(QDataStream &in, BoxItem &b);
83 #endif // __BLOCKITEM_H__