AbstractBoxItem:: AbstractBoxItem(AbstractBlock *_refBlock, Dispatcher *_dispatcher, Parameters *_params, QGraphicsItem *parent) : QGraphicsItem(parent) {
dispatcher = _dispatcher;
params = _params;
- refBlock = _refBlock;
- QFont fontId("Arial",10);
- QFontMetrics fmId(fontId);
+ refBlock = _refBlock;
+ QFontMetrics fmId(params->defaultBlockFont);
nameWidth = fmId.width(refBlock->getName());
nameHeight = fmId.height();
nameMargin = 10;
// NOTE : initInterfaces() is only called in subclasses
}
+AbstractBoxItem::AbstractBoxItem(Dispatcher *_dispatcher, Parameters *_params, QGraphicsItem* parent) : QGraphicsItem(parent) {
+ dispatcher = _dispatcher;
+ params = _params;
+ refBlock = NULL;
+ nameWidth = 0;
+ nameHeight = 0;
+ nameMargin = 10;
+ ifaceMargin = 10;
+
+ // the six following values will be override in subclass constructors
+ minimumBoxWidth = 0;
+ minimumBoxHeight = 0;
+ boxWidth = 0;
+ boxHeight = 0;
+ totalWidth = 0;
+ totalHeight = 0;
+
+ originPoint = QPointF(0.0,0.0);
+
+ selected = false;
+ currentInterface = NULL;
+ rstClkVisible = false;
+
+ setAcceptHoverEvents(true);
+
+ // NOTE : initInterfaces() is only called in subclasses
+}
+
AbstractBoxItem::~AbstractBoxItem() {
foreach(InterfaceItem* inter, interfaces) {
delete inter;
return false;
}
-void AbstractBoxItem::initInterfaces()
-{
+void AbstractBoxItem::setRefBlock(AbstractBlock* _refBlock) {
+ refBlock = _refBlock;
+ QFontMetrics fmId(params->defaultBlockFont);
+ nameWidth = fmId.width(refBlock->getName());
+ nameHeight = fmId.height();
+}
+
+void AbstractBoxItem::initInterfaces() {
/* TO DO : creating all needed InterfaceItem, with by default, input at west and output at east */
int orientation = Parameters::West;