| 90 | } |
| 91 | |
| 92 | void IPProcessEdge::updatePosition() |
| 93 | { |
| 94 | _typeIndex = _from->process()->outputs()->at(_indexFrom).type; |
| 95 | |
| 96 | // main line |
| 97 | QLineF line(_from->pos().toPoint()+QPoint(32,32), _to->pos().toPoint()+QPoint(32,32)); |
| 98 | |
| 99 | // find intersections for arrows |
| 100 | QRectF boundingRect = _to->boundingRect(); |
| 101 | QList<QLineF> lines; |
| 102 | lines.append(QLineF(_to->pos()+boundingRect.topLeft(), _to->pos()+boundingRect.topRight())); |
| 103 | lines.append(QLineF(_to->pos()+boundingRect.topRight(), _to->pos()+boundingRect.bottomRight())); |
| 104 | lines.append(QLineF(_to->pos()+boundingRect.bottomRight(), _to->pos()+boundingRect.bottomLeft())); |
| 105 | lines.append(QLineF(_to->pos()+boundingRect.bottomLeft(), _to->pos()+boundingRect.topLeft())); |
| 106 | |
| 107 | for (int i=0; i<lines.length(); i++) { |
| 108 | QLineF::IntersectType intersectType = line.intersect(lines[i], &_intersectionTo); |
| 109 | if (intersectType == QLineF::BoundedIntersection) |
| 110 | break; |
| 111 | } |
| 112 | |
| 113 | // 2 |
| 114 | QRectF boundingRect2 = _from->boundingRect(); |
| 115 | QList<QLineF> lines2; |
| 116 | lines2.append(QLineF(_from->pos()+boundingRect2.topLeft(), _from->pos()+boundingRect2.topRight())); |
| 117 | lines2.append(QLineF(_from->pos()+boundingRect2.topRight(), _from->pos()+boundingRect2.bottomRight())); |
| 118 | lines2.append(QLineF(_from->pos()+boundingRect2.bottomRight(), _from->pos()+boundingRect2.bottomLeft())); |
| 119 | lines2.append(QLineF(_from->pos()+boundingRect2.bottomLeft(), _from->pos()+boundingRect2.topLeft())); |
| 120 | |
| 121 | for (int i=0; i<lines2.length(); i++) { |
| 122 | QLineF::IntersectType intersectType = line.intersect(lines2[i], &_intersectionFrom); |
| 123 | if (intersectType == QLineF::BoundedIntersection) |
| 124 | break; |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | void IPProcessEdge::paint(QPainter* painter, const QStyleOptionGraphicsItem*, QWidget *) |
| 129 | { |