| 26 | } |
| 27 | |
| 28 | QRectF |
| 29 | Monitor::Edge::boundingRect() const |
| 30 | { |
| 31 | if (!parent_ || !child_) { |
| 32 | return QRectF(); |
| 33 | } |
| 34 | |
| 35 | int x1 = parent_->scenePos().x() + parent_->boundingRect().width() - 2; |
| 36 | int y1 = parent_->scenePos().y() + parent_->boundingRect().height() - 2; |
| 37 | int x2 = child_->scenePos().x() + 2; |
| 38 | int y2 = child_->scenePos().y() + 2; |
| 39 | |
| 40 | // calculate the proper bounding rect. |
| 41 | if (x1 < x2) { |
| 42 | if (y1 < y2) { |
| 43 | return QRectF(x1, y1, x2, y2); |
| 44 | } |
| 45 | else { |
| 46 | return QRectF(x1, y2, x2, y1); |
| 47 | } |
| 48 | } |
| 49 | else { |
| 50 | if (y1 < y2) { |
| 51 | return QRectF(x2, y1, x1, y2); |
| 52 | } |
| 53 | else { |
| 54 | return QRectF(x2, y2, x1, y1); |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | } |
| 59 | |
| 60 | void |
| 61 | Monitor::Edge::paint(QPainter *painter,const QStyleOptionGraphicsItem *,QWidget *) |
no test coverage detected