From 43657d99442e4b33f6df502d16e76a8b577b1381 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Fri, 21 Jun 2013 16:12:04 -0300 Subject: Makes the first and last line of the plot inside of the boundingrect This patch makes the first line and the last line of the plot inside of the boundingRect defined by the timeLine and depthLine Signed-off-by: Tomaz Canabrava --- qt-ui/diveplanner.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'qt-ui/diveplanner.cpp') diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp index bc774cc83..65be6f608 100644 --- a/qt-ui/diveplanner.cpp +++ b/qt-ui/diveplanner.cpp @@ -62,7 +62,9 @@ void DivePlannerGraphics::mouseDoubleClickEvent(QMouseEvent* event) handles << item; if (lines.empty()){ - QGraphicsLineItem *first = new QGraphicsLineItem(0,0, mappedPos.x(), mappedPos.y()); + double xpos = timeLine->posAtValue(0); + double ypos = depthLine->posAtValue(0); + QGraphicsLineItem *first = new QGraphicsLineItem(xpos,ypos, mappedPos.x(), mappedPos.y()); item->from = first; lines.push_back(first); create_deco_stop(); @@ -116,7 +118,9 @@ void DivePlannerGraphics::create_deco_stop() // Create all 'deco' GraphicsLineItems and put it on the canvas.This following three lines will // most probably need to enter on a loop. - QGraphicsLineItem *item = new QGraphicsLineItem(handles.last()->x(), handles.last()->y(), 100, 0); + double xpos = timeLine->posAtValue(timeLine->maximum()); + double ypos = depthLine->posAtValue(depthLine->minimum()); + QGraphicsLineItem *item = new QGraphicsLineItem(handles.last()->x(), handles.last()->y(), xpos, ypos); scene()->addItem(item); lines << item; } -- cgit v1.2.3-70-g09d2