diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2009-04-23 08:46:26 (GMT) |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2009-04-23 08:46:26 (GMT) |
commit | be3916b7e4e8007394cbed40484ef6b696e90f2b (patch) | |
tree | a66dc85f3900e08a040f0d80eb0e56f43a163efc /examples | |
parent | ed24cd82444faeeda0a171a9082808ebb667e092 (diff) | |
parent | 389c4fdebe681eb3af5a2431c390323f52a03c17 (diff) | |
download | Qt-be3916b7e4e8007394cbed40484ef6b696e90f2b.zip Qt-be3916b7e4e8007394cbed40484ef6b696e90f2b.tar.gz Qt-be3916b7e4e8007394cbed40484ef6b696e90f2b.tar.bz2 |
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt
Conflicts:
src/corelib/global/qfeatures.h
src/gui/painting/qtransform.cpp
util/scripts/make_qfeatures_dot_h
Diffstat (limited to 'examples')
-rw-r--r-- | examples/graphicsview/elasticnodes/edge.cpp | 9 |
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; |