summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--qt-ui/diveplanner.cpp10
-rw-r--r--qt-ui/diveplanner.h2
2 files changed, 8 insertions, 4 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();
diff --git a/qt-ui/diveplanner.h b/qt-ui/diveplanner.h
index 682c56ae4..9d87b0c78 100644
--- a/qt-ui/diveplanner.h
+++ b/qt-ui/diveplanner.h
@@ -12,7 +12,7 @@ protected:
virtual void mouseDoubleClickEvent(QMouseEvent* event);
virtual void showEvent(QShowEvent* event);
virtual void resizeEvent(QResizeEvent* event);
-
+
void clear_generated_deco();
void create_deco_stop();