- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
//---------------------------------------------------------
void Link::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
Q_UNUSED(option);
Q_UNUSED(widget);
if ( mA && mB )
{
QPen pen(mColor, mPenWidth);
painter->setPen(pen);
if ( smooth() )
painter->setRenderHint(QPainter::Antialiasing, true);
QString ptname = mA->objectName() + QString("_point%1").arg(mAPoint);
QDeclarativeItem *aConn = mA->findChild<QDeclarativeItem*>(ptname);
QDeclarativeItem *bConn = *(QDeclarativeItem**) mB->property("root").constData();
QRectF arect(aConn->x() + mA->x() - mB->x(), aConn->y() + mA->y() - mB->y(), aConn->width(), aConn->height());
QRectF brect(bConn->x(), bConn->y(), bConn->width(), bConn->height());
QLineF line(arect.center(), brect.center());
painter->drawLine(line);
if ( widget )
widget->update();
}
}