mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
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:
parent
46483a096f
commit
1fb023d3c6
1 changed files with 16 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue