diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/examples.pro | 2 | ||||
-rw-r--r-- | examples/graphicsview/elasticnodes/edge.cpp | 11 |
2 files changed, 9 insertions, 4 deletions
diff --git a/examples/examples.pro b/examples/examples.pro index 874cd37..4677a23 100644 --- a/examples/examples.pro +++ b/examples/examples.pro @@ -36,7 +36,7 @@ embedded:SUBDIRS += qws } contains(QT_CONFIG, opengl): SUBDIRS += opengl contains(QT_CONFIG, dbus): SUBDIRS += dbus -win32:!contains(QT_EDITION, OpenSource|Console):SUBDIRS += activeqt +win32: SUBDIRS += activeqt contains(QT_CONFIG, xmlpatterns): SUBDIRS += xmlpatterns contains(DEFINES, QT_NO_CURSOR): SUBDIRS -= mainwindows 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 |