summaryrefslogtreecommitdiffstats
path: root/examples/graphicsview/elasticnodes/edge.cpp
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2009-04-30 03:26:05 (GMT)
committerMartin Jones <martin.jones@nokia.com>2009-04-30 03:26:05 (GMT)
commit0ee6bf1226f3069f117d0b0b75df14ddf38e75de (patch)
tree01a63f8585790624e1746ba1b43cd91731699e42 /examples/graphicsview/elasticnodes/edge.cpp
parent0a4b78de06b60a5fc0a9182687ded099968c4055 (diff)
parent0282ea19722c247157c652ef9122379f0e715497 (diff)
downloadQt-0ee6bf1226f3069f117d0b0b75df14ddf38e75de.zip
Qt-0ee6bf1226f3069f117d0b0b75df14ddf38e75de.tar.gz
Qt-0ee6bf1226f3069f117d0b0b75df14ddf38e75de.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'examples/graphicsview/elasticnodes/edge.cpp')
-rw-r--r--examples/graphicsview/elasticnodes/edge.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/examples/graphicsview/elasticnodes/edge.cpp b/examples/graphicsview/elasticnodes/edge.cpp
index e32a35a..eb02143 100644
--- a/examples/graphicsview/elasticnodes/edge.cpp
+++ b/examples/graphicsview/elasticnodes/edge.cpp
@@ -96,7 +96,7 @@ void Edge::adjust()
prepareGeometryChange();
- if (!qFuzzyCompare(length, qreal(0.0))) {
+ if (length > qreal(20.)) {
QPointF edgeOffset((line.dx() * 10) / length, (line.dy() * 10) / length);
sourcePoint = line.p1() + edgeOffset;
destPoint = line.p2() - edgeOffset;
@@ -124,12 +124,15 @@ void Edge::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
if (!source || !dest)
return;
- // Draw the line itself
QLineF line(sourcePoint, destPoint);
+ if (qFuzzyCompare(line.length(), qreal(0.)))
+ return;
+
+ // Draw the line itself
painter->setPen(QPen(Qt::black, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
painter->drawLine(line);
- // Draw the arrows if there's enough room
+ // Draw the arrows
double angle = ::acos(line.dx() / line.length());
if (line.dy() >= 0)
angle = TwoPi - angle;