Restore the original color of the Handler as soon as mouseRelease.

Restore the original color of the handler as soon as mouseRelease,
also a bit of code cleanup.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This commit is contained in:
Tomaz Canabrava 2013-06-20 18:02:01 -03:00
parent cbdd78c0fc
commit 0539a5fab6

View file

@ -47,8 +47,6 @@ DivePlanner::DivePlanner(QWidget* parent): QGraphicsView(parent), activeDraggedH
depthString = new QGraphicsSimpleTextItem(); depthString = new QGraphicsSimpleTextItem();
depthString->setFlag(QGraphicsItem::ItemIgnoresTransformations); depthString->setFlag(QGraphicsItem::ItemIgnoresTransformations);
scene()->addItem(depthString); scene()->addItem(depthString);
} }
void DivePlanner::mouseDoubleClickEvent(QMouseEvent* event) void DivePlanner::mouseDoubleClickEvent(QMouseEvent* event)
@ -109,9 +107,6 @@ void DivePlanner::clear_generated_deco()
void DivePlanner::create_deco_stop() void DivePlanner::create_deco_stop()
{ {
// this needs to create everything
// for the calculated deco. it should return the *first*
// line that's calculated, so the
QGraphicsLineItem *item = new QGraphicsLineItem(handles.last()->x(), handles.last()->y(), 100, 0); QGraphicsLineItem *item = new QGraphicsLineItem(handles.last()->x(), handles.last()->y(), 100, 0);
scene()->addItem(item); scene()->addItem(item);
lines << item; lines << item;
@ -227,8 +222,9 @@ void DivePlanner::mouseReleaseEvent(QMouseEvent* event)
{ {
if (activeDraggedHandler){ if (activeDraggedHandler){
QPointF mappedPos = mapToScene(event->pos()); QPointF mappedPos = mapToScene(event->pos());
activeDraggedHandler ->setTime(timeLine->valueAt(mappedPos)); activeDraggedHandler->setTime(timeLine->valueAt(mappedPos));
activeDraggedHandler ->setDepth(depthLine->valueAt(mappedPos)); activeDraggedHandler->setDepth(depthLine->valueAt(mappedPos));
activeDraggedHandler->setBrush(QBrush());
activeDraggedHandler = 0; activeDraggedHandler = 0;
} }
} }