From cbdd78c0fca06645248dafe3999bbabd91c48449 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Thu, 20 Jun 2013 17:54:36 -0300 Subject: Added text to the rules so the user knows what's happening at that point. Added text to the rules, so the user knows what's happening at that point The text will move left / right ( for time ) and up / down ( for depth ) Signed-off-by: Tomaz Canabrava --- qt-ui/diveplanner.cpp | 15 ++++++++++++++- qt-ui/diveplanner.h | 3 +++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp index fa7be75b3..33a759f1d 100644 --- a/qt-ui/diveplanner.cpp +++ b/qt-ui/diveplanner.cpp @@ -39,6 +39,16 @@ DivePlanner::DivePlanner(QWidget* parent): QGraphicsView(parent), activeDraggedH depthLine->setOrientation(Qt::Vertical); depthLine->updateTicks(); scene()->addItem(depthLine); + + timeString = new QGraphicsSimpleTextItem(); + timeString->setFlag(QGraphicsItem::ItemIgnoresTransformations); + scene()->addItem(timeString); + + depthString = new QGraphicsSimpleTextItem(); + depthString->setFlag(QGraphicsItem::ItemIgnoresTransformations); + scene()->addItem(depthString); + + } void DivePlanner::mouseDoubleClickEvent(QMouseEvent* event) @@ -127,10 +137,13 @@ void DivePlanner::mouseMoveEvent(QMouseEvent* event) verticalLine->setLine(mappedPos.x(), 0, mappedPos.x(), 100); horizontalLine->setLine(0, mappedPos.y(), 100, mappedPos.y()); + depthString->setText(QString::number(depthLine->valueAt(mappedPos))); + depthString->setPos(0, mappedPos.y()); + timeString->setText(QString::number( (int) timeLine->valueAt(mappedPos)) + "min"); + timeString->setPos(mappedPos.x()+1, 90); if(activeDraggedHandler) moveActiveHandler(mappedPos); - if (!handles.count()) return; diff --git a/qt-ui/diveplanner.h b/qt-ui/diveplanner.h index f7af25113..0e7f6f4b2 100644 --- a/qt-ui/diveplanner.h +++ b/qt-ui/diveplanner.h @@ -63,7 +63,10 @@ private: DiveHandler *activeDraggedHandler; Ruler *timeLine; + QGraphicsSimpleTextItem *timeString; + Ruler *depthLine; + QGraphicsSimpleTextItem *depthString; }; #endif -- cgit v1.2.3-70-g09d2