diff options
author | Rhys Weatherley <rhys.weatherley@nokia.com> | 2009-04-21 21:03:06 (GMT) |
---|---|---|
committer | Rhys Weatherley <rhys.weatherley@nokia.com> | 2009-04-21 21:03:06 (GMT) |
commit | db4e2a600c53ad857d7fa3f7d84ac995215ecf93 (patch) | |
tree | 88ca89842925080cf18eb9f796310a89216828b0 /examples/graphicsview | |
parent | 4f64ff3e8902529700336c7ad3aa9fccf5ca3e0b (diff) | |
parent | c36ff16f66ffd65839ba1e254ac557e491db6bf4 (diff) | |
download | Qt-db4e2a600c53ad857d7fa3f7d84ac995215ecf93.zip Qt-db4e2a600c53ad857d7fa3f7d84ac995215ecf93.tar.gz Qt-db4e2a600c53ad857d7fa3f7d84ac995215ecf93.tar.bz2 |
Merge branch '4.5'
Conflicts:
src/gui/graphicsview/qgraphicsitem.cpp
tools/qdoc3/test/assistant.qdocconf
tools/qdoc3/test/designer.qdocconf
tools/qdoc3/test/linguist.qdocconf
tools/qdoc3/test/qmake.qdocconf
tools/qdoc3/test/qt-build-docs.qdocconf
tools/qdoc3/test/qt.qdocconf
Diffstat (limited to 'examples/graphicsview')
-rw-r--r-- | examples/graphicsview/elasticnodes/edge.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/examples/graphicsview/elasticnodes/edge.cpp b/examples/graphicsview/elasticnodes/edge.cpp index 4018c25..e32a35a 100644 --- a/examples/graphicsview/elasticnodes/edge.cpp +++ b/examples/graphicsview/elasticnodes/edge.cpp @@ -93,11 +93,16 @@ void Edge::adjust() QLineF line(mapFromItem(source, 0, 0), mapFromItem(dest, 0, 0)); qreal length = line.length(); - QPointF edgeOffset((line.dx() * 10) / length, (line.dy() * 10) / length); prepareGeometryChange(); - sourcePoint = line.p1() + edgeOffset; - destPoint = line.p2() - edgeOffset; + + if (!qFuzzyCompare(length, qreal(0.0))) { + QPointF edgeOffset((line.dx() * 10) / length, (line.dy() * 10) / length); + sourcePoint = line.p1() + edgeOffset; + destPoint = line.p2() - edgeOffset; + } else { + sourcePoint = destPoint = line.p1(); + } } QRectF Edge::boundingRect() const |