| 870 | } |
| 871 | |
| 872 | void MyGraphicsLineItem::setLengthRate(qreal r){ |
| 873 | sP = startVex->scenePos() + startVex->rect().center(); |
| 874 | eP = endVex->scenePos() + endVex->rect().center(); |
| 875 | dP = eP - sP; |
| 876 | angle = atan2(dP.y(), dP.x()); |
| 877 | eP -= QPointF(endVex->getRadius() * cos(angle), endVex->getRadius() * sin(angle)); |
| 878 | sP += QPointF(endVex->getRadius() * cos(angle), endVex->getRadius() * sin(angle)); |
| 879 | dP = (eP - sP) * r; |
| 880 | eP = sP + dP; |
| 881 | } |
| 882 | |
| 883 | void MyGraphicsLineItem::estConnection(MyGraphicsView *view){ |
| 884 | connect(view, SIGNAL(mouseMoved(QPointF)), this, SLOT(onMouseMove(QPointF))); |