QFontMetrics fmId(params->defaultBlockFont);
nameWidth = fmId.width(refBlock->getName());
nameHeight = fmId.height();
- nameMargin = 10;
+ nameMargin = 5;
ifaceMargin = 10;
// the six following values will be override in subclass constructors
bool AbstractBoxItem::isGroupItem() {
return false;
}
+
+bool AbstractBoxItem::isSourceItem() {
+ return false;
+}
+
void AbstractBoxItem::setRstClkVisible(bool b) {
rstClkVisible = b;
foreach(InterfaceItem* ifaceItem, interfaces) {
foreach(AbstractInterface *inter, refBlock->getInterfaces()){
- /* NB: create InterfaceItem for every interfaces, even if they do not have a graphical representation
- It will allow to save them in the XML project file and thus to create their equivalent
- in the graph while the file is loaded.
+ /* NB: does not create InterfaceItem for control interfaces.
*/
- InterfaceItem *item;
- if(inter->getDirection() == AbstractInterface::Input){
- orientation = Parameters::West;
- } else if(inter->getDirection() == AbstractInterface::Output){
- orientation = Parameters::East;
- } else if(inter->getDirection() == AbstractInterface::InOut){
- orientation = Parameters::North;
+ if (inter->getPurpose() != AbstractInterface::Control) {
+ InterfaceItem *item;
+ if(inter->getDirection() == AbstractInterface::Input){
+ orientation = Parameters::West;
+ } else if(inter->getDirection() == AbstractInterface::Output){
+ orientation = Parameters::East;
+ } else if(inter->getDirection() == AbstractInterface::InOut){
+ orientation = Parameters::North;
+ }
+ item = new InterfaceItem(0.0 , orientation, (ConnectedInterface *)inter, this, params);
+ interfaces.append(item);
}
- item = new InterfaceItem(0.0 , orientation, (ConnectedInterface *)inter, this, params);
- interfaces.append(item);
}
}
QRectF AbstractBoxItem::boundingRect() const {
// returns a QRectF that contains the block (i.e the main rectangle, interfaces, title, ...)
- QPointF p = originPoint - QPointF(nameHeight,nameHeight);
- QSizeF s(totalWidth+2*nameHeight,totalHeight+2*nameHeight);
+ QPointF p = originPoint;
+ QSizeF s(totalWidth,totalHeight);
return QRectF(p,s);
}
+QRectF AbstractBoxItem::boundingRectInScene() {
+ /* returns a QRectF in scene coordinates, that contains the block plus
+ a margin of size arrowWidth+arrowLineLength
+ */
+ int marginConn = params->arrowLineLength+params->arrowWidth;
+
+ QPointF posBox = scenePos();
+ posBox.setX(posBox.x()+originPoint.x()-marginConn);
+ posBox.setY(posBox.y()+originPoint.y()-marginConn);
+
+ QSizeF sizeBox(totalWidth+2*marginConn,totalHeight+2*marginConn);
+
+ return QRectF(posBox,sizeBox);
+}
+
/* isInterface() : return true if there are some interfaces
with the given orientation (N,S,E,O)