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 <tcanabrava@kde.org>
This commit is contained in:
Tomaz Canabrava 2013-06-20 17:54:36 -03:00
parent 2d683b66a8
commit cbdd78c0fc
2 changed files with 17 additions and 1 deletions

View file

@ -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;

View file

@ -63,7 +63,10 @@ private:
DiveHandler *activeDraggedHandler;
Ruler *timeLine;
QGraphicsSimpleTextItem *timeString;
Ruler *depthLine;
QGraphicsSimpleTextItem *depthString;
};
#endif