diff options
author | Tomaz Canabrava <tomaz.canabrava@intel.com> | 2014-05-23 20:51:30 -0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-05-24 07:28:39 -0700 |
commit | ea4d4ac020319dee0e1d74ff793ef50ab8c47508 (patch) | |
tree | fd2562b39c4c4e1f098944f050d3b7c018510ae6 /qt-ui/diveplanner.cpp | |
parent | e1dcd8eac32e2e7d606f5bc82106cde07984b42a (diff) | |
download | subsurface-ea4d4ac020319dee0e1d74ff793ef50ab8c47508.tar.gz |
Make the planner actually work.
This commit makes the planner actually work. There ar still
a few edges, but oh, joy - the new Profile gave a very unexpected
and nice addition to it - Grab the last handler of the initial
dive, and move it to the right, or get any handler, and move it
to the bottom to see what I mean.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/diveplanner.cpp')
-rw-r--r-- | qt-ui/diveplanner.cpp | 41 |
1 files changed, 6 insertions, 35 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp index b7a3f0153..6ea88e1e3 100644 --- a/qt-ui/diveplanner.cpp +++ b/qt-ui/diveplanner.cpp @@ -480,36 +480,6 @@ void DivePlannerGraphics::mouseMoveEvent(QMouseEvent *event) #endif } -void DivePlannerGraphics::moveActiveHandler(const QPointF &mappedPos, const int pos) -{ -#if 0 - divedatapoint data = plannerModel->at(pos); - int mintime = 0, maxtime = (timeLine->maximum() + 10) * 60; - if (pos > 0) - mintime = plannerModel->at(pos - 1).time; - if (pos < plannerModel->size() - 1) - maxtime = plannerModel->at(pos + 1).time; - - int minutes = rint(timeLine->valueAt(mappedPos)); - if (minutes * 60 <= mintime || minutes * 60 >= maxtime) - return; - - int milimeters = rint(depthLine->valueAt(mappedPos) / M_OR_FT(1, 1)) * M_OR_FT(1, 1); - double xpos = timeLine->posAtValue(minutes); - double ypos = depthLine->posAtValue(milimeters); - - data.depth = milimeters; - data.time = rint(timeLine->valueAt(mappedPos)) * 60; - - plannerModel->editStop(pos, data); - - activeDraggedHandler->setPos(QPointF(xpos, ypos)); - qDeleteAll(lines); - lines.clear(); - drawProfile(); -#endif -} - void DivePlannerGraphics::mousePressEvent(QMouseEvent *event) { if (event->modifiers()) { @@ -586,12 +556,13 @@ void DiveHandler::changeGas() plannerModel->setData(index, action->text()); } -QVariant DiveHandler::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) +void DiveHandler::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { - if (change == ItemPositionHasChanged && scene()) { - emit moved(); - } - return QGraphicsItem::itemChange(change, value); + ProfileWidget2 *view = qobject_cast<ProfileWidget2*>(scene()->views().first()); + if(view->isPointOutOfBoundaries(event->scenePos())) + return; + QGraphicsEllipseItem::mouseMoveEvent(event); + emit moved(); } Button::Button(QObject *parent, QGraphicsItem *itemParent) : QObject(parent), |