logic: Show inheritance edges between parents of active symbol and other visible symbols (issue #167)

* add inheritance edges between parents of active symbol and other visible symbols
* add dashed inheritance edges when symbols are no direct decendants
* inheritance edges are also respected in layouting, putting base/derived classes in the correct top/bottom spot now

bug id = 167
This commit is contained in:
Eberhard Graether
2017-07-16 18:40:59 +02:00
parent 9a36d48d1e
commit 9d0b86ad98
19 changed files with 261 additions and 17 deletions
+19 -2
View File
@@ -32,7 +32,8 @@ QPainterPath QtLineItemAngled::shape() const
void QtLineItemAngled::paint(QPainter* painter, const QStyleOptionGraphicsItem* options, QWidget* widget)
{
painter->setPen(pen());
QPen p = pen();
painter->setPen(p);
QPainterPath path;
@@ -169,7 +170,17 @@ void QtLineItemAngled::paint(QPainter* painter, const QStyleOptionGraphicsItem*
partRect = getArrowBoundingRect(poly);
if (drawRect.intersects(partRect) && m_showArrow)
{
drawArrow(poly, &path);
if (m_style.dashed)
{
QPainterPath arrowPath;
drawArrow(poly, &path, &arrowPath);
painter->drawPath(arrowPath);
}
else
{
drawArrow(poly, &path);
}
}
else
{
@@ -177,5 +188,11 @@ void QtLineItemAngled::paint(QPainter* painter, const QStyleOptionGraphicsItem*
}
}
if (m_style.dashed)
{
p.setStyle(Qt::DashLine);
painter->setPen(p);
}
painter->drawPath(path);
}
+7 -2
View File
@@ -336,7 +336,7 @@ QRectF QtLineItemBase::getArrowBoundingRect(const QPolygon& poly) const
return rect;
}
void QtLineItemBase::drawArrow(const QPolygon& poly, QPainterPath* path) const
void QtLineItemBase::drawArrow(const QPolygon& poly, QPainterPath* path, QPainterPath* arrowPath) const
{
int dir = getDirection(poly.at(1), poly.at(0));
@@ -364,7 +364,6 @@ void QtLineItemBase::drawArrow(const QPolygon& poly, QPainterPath* path) const
break;
}
if (m_style.arrowClosed)
{
path->lineTo(tip + toBack);
@@ -375,6 +374,12 @@ void QtLineItemBase::drawArrow(const QPolygon& poly, QPainterPath* path) const
path->lineTo(tip);
}
if (arrowPath)
{
path = arrowPath;
path->moveTo(tip);
}
path->lineTo(tip + toBack + toLeft);
if (m_style.arrowClosed)
+1 -1
View File
@@ -45,7 +45,7 @@ protected:
int getDirection(const QPointF& a, const QPointF& b) const;
QRectF getArrowBoundingRect(const QPolygon& poly) const;
void drawArrow(const QPolygon& poly, QPainterPath* path) const;
void drawArrow(const QPolygon& poly, QPainterPath* path, QPainterPath* arrowPath = nullptr) const;
void getPivotPoints(Vec2f* p, const Vec4i& in, const Vec4i& out, int offset, bool target) const;