20 #include <QDomDocument>
40 m_associationWidget(association),
41 m_activePointIndex(-1),
42 m_activeSegmentIndex(-1),
46 m_collaborationLineItem(0),
47 m_collaborationLineHead(0),
50 Q_ASSERT(association);
51 setFlag(QGraphicsLineItem::ItemIsSelectable);
52 setAcceptHoverEvents(
true);
69 if ((index < 0) | (index >= m_points.size())) {
70 uWarning() <<
"Index " << index <<
" out of range [0.." << m_points.size() - 1 <<
"].";
71 return QPointF(-1.0, -1.0);
73 return m_points.at(index);
81 if ((index < 0) | (index >= m_points.size())) {
82 uWarning() <<
"Index " << index <<
" out of range [0.." << m_points.size() - 1 <<
"].";
85 if (m_points.at(index) ==
point) {
88 prepareGeometryChange();
89 m_points[index] =
point;
99 return m_points.at(0);
107 return m_points.at(m_points.size()-1);
116 prepareGeometryChange();
117 m_points.insert(index, point);
127 prepareGeometryChange();
128 m_points.remove(index);
139 return m_points.size();
147 if (!m_points.isEmpty()) {
148 prepareGeometryChange();
164 prepareGeometryChange();
165 while (i < m_points.size()) {
166 if (m_points.at(i) == m_points.at(i-1)) {
187 for(
int i = 0; i < m_points.size(); ++i) {
188 const QPointF& linePoint = m_points.at(i);
190 qreal deltaXSquare = (point.x() - linePoint.x()) * (point.x() - linePoint.x());
191 qreal deltaYSquare = (point.y() - linePoint.y()) * (point.y() - linePoint.y());
193 qreal lhs = deltaXSquare + deltaYSquare;
194 qreal rhs = delta * delta;
213 QPainterPathStroker stroker;
214 stroker.setWidth(delta);
216 for(
int i = 1; i < m_points.size(); ++i) {
217 QLineF segment(m_points[i-1], m_points[i]);
220 path.moveTo(segment.p1());
221 path.lineTo(segment.p2());
223 path = stroker.createStroke(path);
225 if (path.contains(point)) {
237 const int size = m_points.size();
238 Q_ASSERT(index >= 0 && index < size);
240 return (index == 0 || index == (size - 1));
249 const int size = m_points.size() - 1;
250 Q_ASSERT(index >= 0 && index < size);
252 return (index == 0 || index == (size - 1));
260 const int size = m_points.size();
262 prepareGeometryChange();
265 m_points.insert(0, start);
266 m_points.insert(1, end);
268 else if (size == 1) {
270 m_points.insert(1, end);
274 m_points[size-1] = end;
286 for (
int i = 1; i < m_points.size(); ++i) {
287 QPointF p = m_points.at(i);
288 DEBUG(
DBG_SRC) << i <<
". point x:" << p.x() <<
" / y:" << p.y();
297 QString
layout = qElement.attribute(
"layout",
"polyline");
300 QDomNode node = qElement.firstChild();
304 QDomElement startElement = node.toElement();
305 if(startElement.isNull() || startElement.tagName() !=
"startpoint") {
308 QString x = startElement.attribute(
"startx",
"0");
309 qreal nX = x.toFloat();
310 QString y = startElement.attribute(
"starty",
"0");
311 qreal nY = y.toFloat();
314 node = startElement.nextSibling();
315 QDomElement endElement = node.toElement();
316 if(endElement.isNull() || endElement.tagName() !=
"endpoint") {
319 x = endElement.attribute(
"endx",
"0");
321 y = endElement.attribute(
"endy",
"0");
326 node = endElement.nextSibling();
327 QDomElement element = node.toElement();
329 while(!element.isNull()) {
330 if(element.tagName() ==
"point") {
331 x = element.attribute(
"x",
"0");
332 y = element.attribute(
"y",
"0");
333 point.setX(x.toFloat());
334 point.setY(y.toFloat());
337 node = element.nextSibling();
338 element = node.toElement();
351 QDomElement lineElement = qDoc.createElement(
"linepath");
352 lineElement.setAttribute(
"layout",
toString(m_layout));
353 QDomElement startElement = qDoc.createElement(
"startpoint");
354 startElement.setAttribute(
"startx", point.x());
355 startElement.setAttribute(
"starty", point.y());
356 lineElement.appendChild(startElement);
357 QDomElement endElement = qDoc.createElement(
"endpoint");
358 point = m_associationWidget->mapToScene(
endPoint());
359 endElement.setAttribute(
"endx", point.x());
360 endElement.setAttribute(
"endy", point.y());
361 lineElement.appendChild(endElement);
362 for(
int i = 1; i <
count()-1; ++i) {
363 QDomElement pointElement = qDoc.createElement(
"point");
364 point = m_associationWidget->mapToScene(this->
point(i));
365 pointElement.setAttribute(
"x", point.x());
366 pointElement.setAttribute(
"y", point.y());
367 lineElement.appendChild(pointElement);
369 qElement.appendChild(lineElement);
377 QBrush
brush(Qt::SolidPattern);
382 brush.setColor(Qt::white);
385 brush.setColor(m_associationWidget->
lineColor());
404 pen.setStyle(Qt::DashLine);
415 if (m_associationWidget->
isSelf() &&
count() < 4) {
416 for (
int i =
count(); i < 4; ++i) {
421 uError() <<
"AssociationWidget is partially constructed."
422 "UMLWidget for role A is null.";
425 const QRectF
rect = m_associationWidget->mapFromScene(
428 qreal l = rect.left() + .25 * rect.width();
429 qreal r = rect.left() + .75 * rect.width();
430 bool drawAbove = rect.top() >= SelfAssociationMinimumHeight;
431 qreal y = drawAbove ? rect.top() : rect.bottom();
432 qreal yOffset = SelfAssociationMinimumHeight;
438 setPoint(1, QPointF(l, y + yOffset));
439 setPoint(2, QPointF(r, y + yOffset));
441 }
else if (!m_associationWidget->
isSelf() &&
count() < 2) {
462 removeSubsetSymbol();
463 removeCollaborationLine();
469 removeSubsetSymbol();
470 removeCollaborationLine();
477 removeSubsetSymbol();
478 removeCollaborationLine();
485 removeSubsetSymbol();
486 removeCollaborationLine();
492 removeSubsetSymbol();
493 removeCollaborationLine();
499 createSubsetSymbol();
500 removeCollaborationLine();
507 removeSubsetSymbol();
508 createCollaborationLine();
526 delete m_startSymbol;
535 m_startSymbol =
new Symbol(symbolType, m_associationWidget);
559 m_endSymbol =
new Symbol(symbolType, m_associationWidget);
568 void AssociationLine::createSubsetSymbol()
570 delete m_subsetSymbol;
579 void AssociationLine::removeSubsetSymbol()
581 delete m_subsetSymbol;
588 void AssociationLine::createCollaborationLine()
590 const QPen p =
pen();
593 delete m_collaborationLineItem;
594 delete m_collaborationLineHead;
597 m_collaborationLineItem->setPen(p);
600 m_collaborationLineHead->
setPen(p);
606 void AssociationLine::removeCollaborationLine()
608 delete m_collaborationLineItem;
609 m_collaborationLineItem = 0;
611 delete m_collaborationLineHead;
612 m_collaborationLineHead = 0;
620 void AssociationLine::alignSymbols()
622 const int sz = m_points.size();
631 QPolygonF firstLine = polygons.first();
632 QLineF segment(firstLine.at(1), firstLine.at(0));
633 m_startSymbol->
alignTo(segment);
637 QPolygonF lastLine = polygons.last();
638 int maxIndex = lastLine.size();
639 QLineF segment(lastLine.at(maxIndex-2), lastLine.at(maxIndex-1));
643 if (m_subsetSymbol) {
644 QPointF p1 =
path().pointAtPercent(0.4);
645 QPointF p2 =
path().pointAtPercent(0.5);
646 QLineF segment(p1, p2);
647 m_subsetSymbol->
alignTo(segment);
650 if (m_collaborationLineItem) {
651 const qreal distance = 10;
652 const int midSegmentIndex = (sz - 1) / 2;
654 const QPointF a = m_points.at(midSegmentIndex);
655 const QPointF b = m_points.at(midSegmentIndex + 1);
657 const QPointF p1 = (a + b) / 2.0;
658 const QPointF p2 = (p1 + b) / 2.0;
661 QLineF segment(p2, p1);
662 QLineF normal = segment.normalVector().unitVector();
663 normal.setLength(distance);
666 actualLine.setP2(normal.p2());
668 normal.translate(p1 - p2);
669 actualLine.setP1(normal.p2());
671 m_collaborationLineItem->setLine(actualLine);
672 m_collaborationLineHead->
alignTo(actualLine);
681 if (m_points.count() > 0) {
685 path.moveTo(m_points.first());
686 path.lineTo(m_points.last());
690 path = createBezierCurve(m_points);
694 path = createOrthogonalPath(m_points);
699 QPolygonF polygon(m_points);
700 path.addPolygon(polygon);
706 return QPainterPath();
717 QPolygonF polygon(m_points);
718 QRectF
rect = polygon.boundingRect();
719 const qreal margin(5.0);
720 rect.adjust(-margin, -margin, margin, margin);
729 QPainterPathStroker stroker;
730 stroker.setWidth(qMax<qreal>(2*SelectedPointDiameter,
pen().widthF()) + 2.0);
731 stroker.setCapStyle(Qt::FlatCap);
732 return stroker.createStroke(
path());
748 if (layout ==
"Direct")
750 if (layout ==
"Spline")
752 if (layout ==
"Orthogonal")
772 prepareGeometryChange();
776 createSplinePoints();
786 void AssociationLine::createSplinePoints()
788 if (m_points.size() == 2) {
789 QPointF p1 = m_points.first();
790 QPointF p2 = m_points.last();
791 qreal dx = p2.x() - p1.x();
792 qreal dy = p2.y() - p1.y();
793 qreal oneThirdX = 0.33 * dx;
794 qreal oneThirdY = 0.33 * dy;
795 QPointF c1(p1.x() + oneThirdX,
797 QPointF c2(p2.x() - oneThirdX,
802 if (m_points.size() == 3) {
816 if (points.size() > 3) {
817 path.moveTo(points.at(0));
819 while (i + 2 < points.size()) {
820 path.cubicTo(points.at(i), points.at(i+1), points.at(i+2));
823 while (i < points.size()) {
824 path.lineTo(points.at(i));
829 if (points.size() == 3) {
830 path.moveTo(points.at(0));
831 path.quadTo(points.at(1), points.at(2));
834 QPolygonF polygon(points);
835 path.addPolygon(polygon);
850 if (points.size() > 1) {
851 QPointF start = points.first();
852 QPointF end = points.last();
853 qreal deltaX = abs(start.x() - end.x());
854 qreal deltaY = abs(start.y() - end.y());
858 for (
int i = 0; i < points.size() - 1; ++i) {
859 QPointF curr = points.at(i);
860 QPointF next = points.at(i+1);
861 QPointF center = (next + curr)/2.0;
864 if (deltaX < deltaY) {
866 vector.append(QPointF(curr.x(), center.y()));
867 vector.append(QPointF(next.x(), center.y()));
871 vector.append(QPointF(center.x(), curr.y()));
872 vector.append(QPointF(center.x(), next.y()));
877 QPolygonF rectLine(vector);
878 path.addPolygon(rectLine);
881 QPolygonF polygon(points);
882 path.addPolygon(polygon);
895 const QColor orig = _pen.color().lighter();
896 QColor invertedColor(orig.green(), orig.blue(), orig.red());
897 if (invertedColor == _pen.color()) {
899 invertedColor.setRed((invertedColor.red() + 50) % 256);
901 invertedColor.setAlpha(150);
903 int sz = m_points.size();
909 QPointF savedStart = m_points.first();
910 QPointF savedEnd = m_points.last();
914 QPointF newStart = m_startSymbol->mapToParent(m_startSymbol->
symbolEndPoints().first);
915 m_points[0] = newStart;
919 QPointF newEnd = m_endSymbol->mapToParent(m_endSymbol->
symbolEndPoints().first);
920 m_points[sz - 1] = newEnd;
923 painter->setPen(_pen);
924 painter->setBrush(Qt::NoBrush);
925 painter->drawPath(
path());
927 if (option->state & QStyle::State_Selected) {
929 QPainterPathStroker stroker;
930 stroker.setWidth(3.0);
931 QPainterPath outline = stroker.createStroke(
path());
932 QColor shadowColor(Qt::lightGray);
933 shadowColor.setAlpha(80);
934 QBrush shadowBrush(shadowColor);
935 painter->setBrush(shadowBrush);
936 painter->setPen(Qt::NoPen);
937 painter->drawPath(outline);
940 _pen.setColor(Qt::blue);
941 QRectF circle(0, 0, SelectedPointDiameter, SelectedPointDiameter);
942 painter->setBrush(_pen.color());
943 painter->setPen(Qt::NoPen);
946 circle.moveCenter(savedStart);
947 painter->drawRect(circle);
948 for (
int i = 1; i < sz-1; ++i) {
949 if (i != m_activePointIndex) {
950 circle.moveCenter(m_points.at(i));
951 painter->drawRect(circle);
954 circle.moveCenter(savedEnd);
955 painter->drawRect(circle);
957 if (m_activePointIndex != -1) {
958 painter->setBrush(invertedColor);
959 painter->setPen(Qt::NoPen);
960 circle.setWidth(1.5*SelectedPointDiameter);
961 circle.setHeight(1.5*SelectedPointDiameter);
962 circle.moveCenter(m_points.at(m_activePointIndex));
963 painter->drawEllipse(circle);
965 else if (m_activeSegmentIndex != -1) {
967 painter->setPen(QPen(invertedColor, _pen.widthF() + 1));
968 painter->setBrush(Qt::NoBrush);
970 QLineF segmentLine(m_points[m_activeSegmentIndex], m_points[m_activeSegmentIndex + 1]);
971 painter->drawLine(segmentLine);
977 painter->setPen(Qt::green);
978 painter->setBrush(Qt::NoBrush);
979 painter->drawPath(
shape());
980 painter->setPen(Qt::red);
983 painter->drawLine(-10, 0, 10, 0);
984 painter->drawLine(0, -10, 0, 10);
989 m_points[0] = savedStart;
990 m_points[sz - 1] = savedEnd;
999 if (event->buttons() & Qt::LeftButton) {
1001 if (m_activePointIndex != -1 &&
isEndPointIndex(m_activePointIndex)) {
1003 m_activePointIndex = -1;
1006 m_activeSegmentIndex = (m_activePointIndex != -1) ? -1 :
closestSegmentIndex(event->scenePos());
1008 else if (event->buttons() & Qt::RightButton) {
1009 DEBUG(
DBG_SRC) <<
"call context menu of association widget at " <<
event->scenePos();
1012 m_activePointIndex = -1;
1013 m_activeSegmentIndex = -1;
1022 if (m_activePointIndex != -1) {
1023 setPoint(m_activePointIndex, event->scenePos());
1025 else if (m_activeSegmentIndex != -1 && !
isEndSegmentIndex(m_activeSegmentIndex)) {
1026 QPointF delta =
event->scenePos() -
event->lastScenePos();
1027 setPoint(m_activeSegmentIndex, m_points[m_activeSegmentIndex] + delta);
1028 setPoint(m_activeSegmentIndex + 1, m_points[m_activeSegmentIndex + 1] + delta);
1040 if (event->buttons() & Qt::LeftButton) {
1041 m_activeSegmentIndex = -1;
1042 m_activePointIndex = -1;
1053 int oldPointIndex = m_activePointIndex;
1054 int oldSegmentIndex = m_activeSegmentIndex;
1058 if (m_activePointIndex != -1 &&
isEndPointIndex(m_activePointIndex)) {
1059 m_activePointIndex = -1;
1062 m_activeSegmentIndex = (m_activePointIndex != -1) ? -1 :
closestSegmentIndex(event->scenePos());
1064 bool isChanged = (oldSegmentIndex != m_activeSegmentIndex || oldPointIndex != m_activePointIndex);
1066 m_associationWidget->update();
1076 int oldPointIndex = m_activePointIndex;
1077 int oldSegmentIndex = m_activeSegmentIndex;
1081 if (m_activePointIndex != -1 &&
isEndPointIndex(m_activePointIndex)) {
1082 m_activePointIndex = -1;
1085 m_activeSegmentIndex = (m_activePointIndex != -1) ? -1 :
closestSegmentIndex(event->scenePos());
1087 bool isChanged = (oldSegmentIndex != m_activeSegmentIndex || oldPointIndex != m_activePointIndex);
1089 m_associationWidget->update();
1100 m_activePointIndex = -1;
1101 m_activeSegmentIndex = -1;
1102 m_associationWidget->update();
1113 Symbol::SymbolProperty Symbol::symbolTable[Count] =
1116 QRectF(-6, 0, 12, 10), QPainterPath(), QLineF(0, 0, 0, 10),
1117 SymbolEndPoints(QPointF(0, 10), QPointF(0, 10))
1120 QRectF(-6, 0, 12, 10), QPainterPath(), QLineF(0, 0, 0, 10),
1121 SymbolEndPoints(QPointF(0, 0), QPointF(0, 10))
1124 QRectF(-6, 0, 12, 10), QPainterPath(), QLineF(0, 0, 0, 10),
1125 SymbolEndPoints(QPointF(0, 10), QPointF(0, 10))
1128 QRectF(-5, -10, 10, 20), QPainterPath(), QLineF(0, -10, 0, 10),
1129 SymbolEndPoints(QPointF(0, -10), QPointF(0, 10))
1132 QRectF(-15, -10, 30, 20), QPainterPath(), QLineF(-10, 0, 0, 0),
1133 SymbolEndPoints(QPointF(0, 0), QPointF(0, 0))
1136 QRectF(-8, -8, 16, 16), QPainterPath(), QLineF(0, -8, 0, 8),
1137 SymbolEndPoints(QPointF(0, -8), QPointF(0, 8))
1145 void Symbol::setupSymbolTable()
1147 SymbolProperty &openArrow = symbolTable[
OpenArrow];
1148 if (openArrow.shape.isEmpty()) {
1149 QRectF
rect = openArrow.boundRect;
1151 openArrow.shape.moveTo(rect.topLeft());
1152 openArrow.shape.lineTo(rect.center().x(), rect.bottom());
1153 openArrow.shape.lineTo(rect.topRight());
1156 SymbolProperty &closedArrow = symbolTable[
ClosedArrow];
1157 if (closedArrow.shape.isEmpty()) {
1158 QRectF rect = closedArrow.boundRect;
1160 closedArrow.shape.moveTo(rect.topLeft());
1161 closedArrow.shape.lineTo(rect.center().x(), rect.bottom());
1162 closedArrow.shape.lineTo(rect.topRight());
1163 closedArrow.shape.lineTo(rect.topLeft());
1166 SymbolProperty &crowFeet = symbolTable[
CrowFeet];
1167 if (crowFeet.shape.isEmpty()) {
1168 QRectF rect = crowFeet.boundRect;
1170 QPointF topMid(rect.center().x(), rect.top());
1173 crowFeet.shape.moveTo(rect.bottomLeft());
1174 crowFeet.shape.lineTo(topMid);
1177 crowFeet.shape.moveTo(rect.center().x(), rect.bottom());
1178 crowFeet.shape.lineTo(topMid);
1181 crowFeet.shape.moveTo(rect.bottomRight());
1182 crowFeet.shape.lineTo(topMid);
1185 SymbolProperty &diamond = symbolTable[
Diamond];
1186 if (diamond.shape.isEmpty()) {
1187 QRectF rect = diamond.boundRect;
1189 diamond.shape.moveTo(rect.center().x(), rect.top());
1190 diamond.shape.lineTo(rect.left(), rect.center().y());
1191 diamond.shape.lineTo(rect.center().x(), rect.bottom());
1192 diamond.shape.lineTo(rect.right(), rect.center().y());
1193 diamond.shape.lineTo(rect.center().x(), rect.top());
1196 SymbolProperty &subset = symbolTable[
Subset];
1197 if (subset.shape.isEmpty()) {
1198 QRectF rect = subset.boundRect;
1200 qreal start = 90, span = 180;
1201 subset.shape.arcMoveTo(rect, start);
1202 subset.shape.arcTo(rect, start, span);
1205 SymbolProperty &circle = symbolTable[
Circle];
1206 if (circle.shape.isEmpty()) {
1207 QRectF rect = circle.boundRect;
1209 circle.shape.addEllipse(rect);
1211 circle.shape.moveTo(rect.center().x(), rect.top());
1212 circle.shape.lineTo(rect.center().x(), rect.bottom());
1214 circle.shape.moveTo(rect.left(), rect.center().y());
1215 circle.shape.lineTo(rect.right(), rect.center().y());
1226 m_symbolType(symbolType)
1244 return m_symbolType;
1252 prepareGeometryChange();
1262 Q_UNUSED(option) Q_UNUSED(widget)
1263 painter->setPen(m_pen);
1264 switch (m_symbolType) {
1273 painter->drawPath(Symbol::symbolTable[m_symbolType].
shape);
1281 const qreal adj = .5 * m_pen.widthF();
1282 return Symbol::symbolTable[m_symbolType].boundRect.
1283 adjusted(-adj, -adj, adj, adj);
1307 QLineF toMapped(mapFromParent(to.p1()), mapFromParent(to.p2()));
1309 QLineF origAxis = Symbol::symbolTable[m_symbolType].axisLine;
1310 QLineF translatedAxis = origAxis.translated(toMapped.p2() - origAxis.p2());
1312 qreal angle = translatedAxis.angleTo(toMapped);
1316 moveBy(delta.x(), delta.y());
1324 return Symbol::symbolTable[m_symbolType].endPoints;
1340 prepareGeometryChange();
1343 m_pen.setStyle(Qt::SolidLine);
1363 #include "associationline.moc"
virtual ~Symbol()
Destructor.
QPair< QPointF, QPointF > SymbolEndPoints
static QString toString(LayoutType layout)
Convert enum LayoutType to string.
int closestSegmentIndex(const QPointF &point, qreal delta=Delta) const
Return index of closest segment.
bool isEndSegmentIndex(int index) const
Retval True If segment at index is start or end.
QPointF startPoint() const
Shortcut for point(0).
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
Reset active indices and also push undo command.
bool loadFromXMI(QDomElement &qElement)
Loads AssociationLine information saved in qElement XMI element.
virtual QPainterPath shape() const
int count() const
Returns the amount of POINTS on the line.
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
Draws the current symbol using the QPainterPath stored for the current symbol.
void setPen(const QPen &pen)
Sets the pen used to draw the symbol.
int closestPointIndex(const QPointF &point, qreal delta=Delta) const
Return index of point closer a given delta.
QRectF boundingRect() const
The points are used for the bounding rect.
#define DEBUG_REGISTER_DISABLED(src)
void hoverMoveEvent(QGraphicsSceneHoverEvent *event)
Calculates the "to be highlighted" point and segment indicies and updates if necessary.
#define ENUM_NAME(o, e, v)
In a Q_OBJECT class define any enum as Q_ENUMS.
void calculateInitialEndPoints()
This method simply ensures presence of two points and adds the needed points for self associations...
QPainterPath shape() const
A convenience class that encapsulates geometry management, handles mouse and hover events...
void setBrush(const QBrush &brush)
Sets the brush used to fill symbol.
static LayoutType fromString(const QString &layout)
Convert string to enum LayoutType.
SymbolType
This enumeration lists all the symbols that can be used as embedded on AssociationLine.
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
Reimplemented from QGraphicsItem::paint.
void mouseMoveEvent(QGraphicsSceneMouseEvent *event)
Moves the point or line if active.
void optimizeLinePoints()
This method optimizes the number of points in the AssociationLine.
void removePoint(int index)
Removes the point at index passed in.
bool setEndPoints(const QPointF &start, const QPointF &end)
Sets the start and end points.
static Tracer * instance()
Symbol(SymbolType symbolType, QGraphicsItem *parent=0)
Constructs a Symbol with current symbol being symbol and parented to parent.
void saveToXMI(QDomDocument &qDoc, QDomElement &qElement)
Saves association line information into XMI element named "linepath".
void setLayout(LayoutType layout)
Set the layout type of the association line.
virtual ~AssociationLine()
Destructor.
void alignTo(const QLineF &line)
This method aligns this Symbol to the line being passed.
void cleanup()
Removes all the points and signals a geometry update.
void insertPoint(int index, const QPointF &point)
Inserts the passed in point at the index passed in and recalculates the bounding rect.
void reconstructSymbols()
This method creates, deletes symbols and collaboration lines based on m_associationWidget->associatio...
void setSymbolType(SymbolType symbolType)
Sets the current symbol type to symbol and updates the geometry.
QPen pen() const
Returns the type of pen to use depending on the type of Association.
QPointF point(int index) const
Returns the point at the point index.
void mousePressEvent(QGraphicsSceneMouseEvent *event)
Determines the active point or segment, the latter being given more priority.
void hoverEnterEvent(QGraphicsSceneHoverEvent *event)
Calculates the "to be highlighted" point and segment indicies and updates if necessary.
This class provides with various symbols that can be embedded in AssociationLine. ...
SymbolEndPoints symbolEndPoints() const
bool isEndPointIndex(int index) const
Retval True If point at index is start or end.
bool setPoint(int index, const QPointF &point)
Sets the point value at given index to point.
QPointF endPoint() const
Shortcut for end point.
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
Reset active indicies and updates.
void dumpPoints()
Debug helper method to write out the points.
QBrush brush() const
Returns the type of brush to use depending on the type of Association.
LayoutType layout() const
Return the layout type of the association line.
virtual QRectF boundingRect() const
SymbolType symbolType() const
QPainterPath path() const