Make the cross red when you cant plot a dive stop

Make the cross red when you cant plot a dive stop,
also make impossible to put a dive stop before the last one.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This commit is contained in:
Tomaz Canabrava 2013-06-20 14:20:45 -03:00
parent 46483a096f
commit 1fb023d3c6

View file

@ -29,6 +29,10 @@ void DivePlanner::mouseDoubleClickEvent(QMouseEvent* event)
if(isPointOutOfBoundaries(mappedPos))
return;
if(handles.count() && handles.last()->x() > mappedPos.x()){
return;
}
QGraphicsEllipseItem *item = new QGraphicsEllipseItem(-5,-5,10,10);
item->setFlag(QGraphicsItem::ItemIgnoresTransformations);
@ -87,8 +91,20 @@ void DivePlanner::mouseMoveEvent(QMouseEvent* event)
QPointF mappedPos = mapToScene(event->pos());
if (isPointOutOfBoundaries(mappedPos))
return;
verticalLine->setLine(mappedPos.x(), 0, mappedPos.x(), 100);
horizontalLine->setLine(0, mappedPos.y(), 100, mappedPos.y());
if (!handles.count())
return;
if (handles.last()->x() > mappedPos.x()){
verticalLine->setPen( QPen(QBrush(Qt::red), 0, Qt::SolidLine));
horizontalLine->setPen( QPen(QBrush(Qt::red), 0, Qt::SolidLine));
}else{
verticalLine->setPen(QPen(Qt::DotLine));
horizontalLine->setPen(QPen(Qt::DotLine));
}
}
bool DivePlanner::isPointOutOfBoundaries(QPointF point)