From 4e158477364f5f75b12b7f93d94207394f741e98 Mon Sep 17 00:00:00 2001 From: "Sandro S. Andrade" Date: Sun, 17 Nov 2013 02:15:07 -0300 Subject: Add handling of UML association with aggregation = 'composite' Change-Id: I10a9c266df43c4c43eb98e9aca820a1c049e8be6 Reviewed-by: Sandro S. Andrade --- examples/uml/duse-mt/src/app/example.xmi | 2 +- .../plugins/umlconcretesyntax/qmlplugin/relationshipitem.cpp | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'examples/uml') diff --git a/examples/uml/duse-mt/src/app/example.xmi b/examples/uml/duse-mt/src/app/example.xmi index e733ab01..26f0e517 100644 --- a/examples/uml/duse-mt/src/app/example.xmi +++ b/examples/uml/duse-mt/src/app/example.xmi @@ -23,7 +23,7 @@ - + diff --git a/examples/uml/duse-mt/src/plugins/umlconcretesyntax/qmlplugin/relationshipitem.cpp b/examples/uml/duse-mt/src/plugins/umlconcretesyntax/qmlplugin/relationshipitem.cpp index 807ad3f4..b1790525 100644 --- a/examples/uml/duse-mt/src/plugins/umlconcretesyntax/qmlplugin/relationshipitem.cpp +++ b/examples/uml/duse-mt/src/plugins/umlconcretesyntax/qmlplugin/relationshipitem.cpp @@ -74,11 +74,20 @@ void RelationshipItem::paint(QPainter *painter) if (originalLine.intersect(QLineF(x2 + w2, y2 , x2 + w2, y2 + h2), &p2) == QLineF::BoundedIntersection) {} painter->drawLine(p1.x()-x(), p1.y()-y(), p2.x()-x(), p2.y()-y()); + QPolygonF arrow(QVector() << QPointF(-10, -10) << QPointF(0, 0) << QPointF(-10, +10)); QTransform transform; transform.translate(p2.x()-x(), p2.y()-y()); transform.rotate(-originalLine.angle()); - QPolygonF arrow(QVector() << QPointF(-10, -10) << QPointF(0, 0) << QPointF(-10, +10)); painter->drawPolyline(transform.map(arrow)); + + if (_end1Aggregation == "composite") { + painter->setBrush(QBrush(Qt::black)); + QPolygon diamond(QVector() << QPoint(0, 0) << QPoint(10, -10) << QPoint(20, 0) << QPoint(10, 10)); + QTransform transform; + transform.translate(p1.x()-x(), p1.y()-y()); + transform.rotate(-originalLine.angle()); + painter->drawPolygon(transform.map(diamond)); + } } QQuickRectangle *RelationshipItem::end1() const -- cgit v1.2.3