From 245c6f522b136cf5d35eb95efb02163da55c6b4b Mon Sep 17 00:00:00 2001 From: dismine Date: Fri, 23 Jan 2015 17:05:23 +0200 Subject: [PATCH] Don't show arrow if edge too short. --HG-- branch : develop --- src/libs/vlayout/vposition.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/libs/vlayout/vposition.cpp b/src/libs/vlayout/vposition.cpp index e99b5a0c9..23c977cf3 100644 --- a/src/libs/vlayout/vposition.cpp +++ b/src/libs/vlayout/vposition.cpp @@ -662,15 +662,21 @@ QVector VPosition::Triplet(const QLineF &edge) const //--------------------------------------------------------------------------------------------------------------------- QPainterPath VPosition::ShowDirection(const QLineF &edge) { + const int arrowLength = 14; + QPainterPath path; + if (edge.length()/arrowLength < 5) + { + return path; + } + QLineF arrow = edge; arrow.setLength(edge.length()/2.0); //Reverse line because we want start arrow from this point arrow = QLineF(arrow.p2(), arrow.p1()); const qreal angle = arrow.angle();//we each time change line angle, better save original angle value - arrow.setLength(14);//arrow length in pixels + arrow.setLength(arrowLength);//arrow length in pixels - QPainterPath path; arrow.setAngle(angle-35); path.moveTo(arrow.p1()); path.lineTo(arrow.p2());