diff options
author | Tomaz Canabrava <tcanabrava@kde.org> | 2013-06-20 13:39:41 -0300 |
---|---|---|
committer | Tomaz Canabrava <tcanabrava@kde.org> | 2013-06-20 13:39:41 -0300 |
commit | b1c526ddb4508a0694e46a6e48a1b0f900072f37 (patch) | |
tree | 3ae592fc893142bffdd8162ff0883086543fe303 /qt-ui/diveplanner.cpp | |
parent | 364254ed36d98ebe61385ddd7d2062c0f7214df3 (diff) | |
download | subsurface-b1c526ddb4508a0694e46a6e48a1b0f900072f37.tar.gz |
Fix creation of the poligon-based lines for the dive planner
This fixes the creation of the poligon-based lines
next thing to do is to forbit creation of the next point
before the last one.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Diffstat (limited to 'qt-ui/diveplanner.cpp')
-rw-r--r-- | qt-ui/diveplanner.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp index a22efb200..0176e2c85 100644 --- a/qt-ui/diveplanner.cpp +++ b/qt-ui/diveplanner.cpp @@ -1,6 +1,6 @@ #include "diveplanner.h" #include <QMouseEvent> -#include <boost/graph/graph_concepts.hpp> +#include <QDebug> DivePlanner* DivePlanner::instance() { @@ -26,18 +26,22 @@ void DivePlanner::mouseDoubleClickEvent(QMouseEvent* event) if (lines.empty()){ QGraphicsLineItem *first = new QGraphicsLineItem(0,0, mappedPos.x(), mappedPos.y()); - lines << first; + lines.push_back(first); create_deco_stop(); scene()->addItem(first); }else{ clear_generated_deco(); + QGraphicsEllipseItem *prevHandle = handles.at( handles.count()-2); + QGraphicsLineItem *line = new QGraphicsLineItem(prevHandle->x(), prevHandle->y(), item->x(), item->y()); + lines.push_back(line); + scene()->addItem(line); create_deco_stop(); } } void DivePlanner::clear_generated_deco() { - for(int i = handles.count(); i < lines.count(); i++){ + for(int i = handles.count(); i <= lines.count(); i++){ scene()->removeItem(lines.last()); delete lines.last(); lines.removeLast(); |