From 5a1be7620b4786d3522496e839bbdce5794f8ef9 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Sun, 18 Jan 2015 14:34:00 -0200 Subject: [PATCH] Only update the "add dive profile / plan dive" 20x/s We were updating the dive quite a lot of times, we really didn't need to. This will help, but not fix, the issues with plan / add dive. Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-ui/diveplanner.cpp | 6 ++++++ qt-ui/diveplanner.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp index 44ca6baf5..2ee168413 100644 --- a/qt-ui/diveplanner.cpp +++ b/qt-ui/diveplanner.cpp @@ -181,6 +181,7 @@ DiveHandler::DiveHandler() : QGraphicsEllipseItem() setFlags(ItemIgnoresTransformations | ItemIsSelectable | ItemIsMovable | ItemSendsGeometryChanges); setBrush(Qt::white); setZValue(2); + t.start(); } int DiveHandler::parentIndex() @@ -225,9 +226,14 @@ void DiveHandler::changeGas() void DiveHandler::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { + if (t.elapsed() < 40) + return; + t.start(); + ProfileWidget2 *view = qobject_cast(scene()->views().first()); if(view->isPointOutOfBoundaries(event->scenePos())) return; + QGraphicsEllipseItem::mouseMoveEvent(event); emit moved(); } diff --git a/qt-ui/diveplanner.h b/qt-ui/diveplanner.h index e6ae8e8b5..4093bacd1 100644 --- a/qt-ui/diveplanner.h +++ b/qt-ui/diveplanner.h @@ -133,6 +133,8 @@ public slots: void selfRemove(); void changeGas(); +private: + QTime t; }; #include "ui_diveplanner.h"