diff options
author | Tomaz Canabrava <tcanabrava@kde.org> | 2013-06-20 14:20:45 -0300 |
---|---|---|
committer | Tomaz Canabrava <tcanabrava@kde.org> | 2013-06-20 14:20:45 -0300 |
commit | 1fb023d3c67834df047c3bd97f7c701a92afbd97 (patch) | |
tree | 1ab2671aa9e7d87ed4f5f385b51c45f058a32edb | |
parent | 46483a096f98b3dc7186bb6971d6e5009cfb2b13 (diff) | |
download | subsurface-1fb023d3c67834df047c3bd97f7c701a92afbd97.tar.gz |
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>
-rw-r--r-- | qt-ui/diveplanner.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp index d4dd7d5bf..fc5b701a7 100644 --- a/qt-ui/diveplanner.cpp +++ b/qt-ui/diveplanner.cpp @@ -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) |