X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/d30c9cf675ad7141d1c8e31d2e72315267d45cf2..d43174d0eb3d293b3bb5fbe76662241134e74d0d:/AbstractBoxItem.cpp?ds=sidebyside diff --git a/AbstractBoxItem.cpp b/AbstractBoxItem.cpp index ec791fb..c4cdae9 100644 --- a/AbstractBoxItem.cpp +++ b/AbstractBoxItem.cpp @@ -15,9 +15,8 @@ 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; @@ -42,6 +41,34 @@ AbstractBoxItem:: AbstractBoxItem(AbstractBlock *_refBlock, Dispatcher *_dispat // 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; @@ -57,8 +84,14 @@ bool AbstractBoxItem::isGroupItem() { 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;