mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Moving Handler on Graphics Updates the Model on the Planner
Moving the handler on the graphics updates the model on the planner Unfortunately, the graphics will move back to it's original position because of the legacy code used to calculate the dive plan. Next: fix the legacy code used to calculate the dive plan. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This commit is contained in:
parent
bc71f9a916
commit
de2f5d9e60
2 changed files with 15 additions and 26 deletions
|
@ -367,31 +367,7 @@ void DivePlannerGraphics::mouseDoubleClickEvent(QMouseEvent* event)
|
|||
|
||||
int minutes = rint(timeLine->valueAt(mappedPos));
|
||||
int meters = rint(depthLine->valueAt(mappedPos));
|
||||
|
||||
// Q_FOREACH(DiveHandler* handler, handles){
|
||||
// if (xpos == handler->pos().x()){
|
||||
// qDebug() << "There's already an point at that place.";
|
||||
// //TODO: Move this later to a KMessageWidget.
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
|
||||
DivePlannerPointsModel::instance()->addStop(meters, minutes, tr("Air"), 0);
|
||||
// DiveHandler *item = new DiveHandler ();
|
||||
// item->sec = minutes * 60;
|
||||
// item->mm = meters * 1000;
|
||||
// item->setPos(QPointF(xpos, ypos));
|
||||
// scene()->addItem(item);
|
||||
// handles << item;
|
||||
//
|
||||
// Button *gasChooseBtn = new Button();
|
||||
// gasChooseBtn ->setText(tr("Air"));
|
||||
// scene()->addItem(gasChooseBtn);
|
||||
// gasChooseBtn->setZValue(10);
|
||||
// connect(gasChooseBtn, SIGNAL(clicked()), this, SLOT(prepareSelectGas()));
|
||||
//
|
||||
// gases << gasChooseBtn;
|
||||
// createDecoStops();
|
||||
}
|
||||
|
||||
void DivePlannerGraphics::prepareSelectGas()
|
||||
|
@ -633,8 +609,14 @@ void DivePlannerGraphics::mouseReleaseEvent(QMouseEvent* event)
|
|||
}
|
||||
}
|
||||
|
||||
activeDraggedHandler->sec = rint(timeLine->valueAt(mappedPos)) * 60;
|
||||
activeDraggedHandler->mm = rint(depthLine->valueAt(mappedPos)) * 1000;
|
||||
int pos = handles.indexOf(activeDraggedHandler);
|
||||
divedatapoint data = DivePlannerPointsModel::instance()->at(pos);
|
||||
|
||||
data.depth = rint(depthLine->valueAt(mappedPos));
|
||||
data.time = rint(timeLine->valueAt(mappedPos));
|
||||
|
||||
DivePlannerPointsModel::instance()->editStop(pos, data);
|
||||
|
||||
activeDraggedHandler->setBrush(QBrush(Qt::white));
|
||||
activeDraggedHandler->setPos(QPointF(xpos, ypos));
|
||||
|
||||
|
@ -964,6 +946,12 @@ int DivePlannerPointsModel::addStop(int meters, int minutes, const QString& gas,
|
|||
return row;
|
||||
}
|
||||
|
||||
void DivePlannerPointsModel::editStop(int row, divedatapoint newData)
|
||||
{
|
||||
divepoints[row] = newData;
|
||||
emit dataChanged(createIndex(row, 0), createIndex(row, COLUMNS-1));
|
||||
}
|
||||
|
||||
divedatapoint DivePlannerPointsModel::at(int row)
|
||||
{
|
||||
return divepoints.at(row);
|
||||
|
|
|
@ -31,6 +31,7 @@ public:
|
|||
* @return the row number.
|
||||
*/
|
||||
int addStop(int meters, int minutes,const QString& gas, int ccpoint );
|
||||
void editStop(int row, divedatapoint newData );
|
||||
divedatapoint at(int row);
|
||||
public slots:
|
||||
void setGFHigh(short gfhigh);
|
||||
|
|
Loading…
Add table
Reference in a new issue