The patch 0002 was very hard to track. the profile now is super smooth. :)
From 85b3421bc324bb012e2f951fba68e520397ac9ee Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <[email protected]> Date: Sun, 18 Jan 2015 14:34:00 -0200 Subject: [PATCH 1/2] Only update the Added Dive Profile / Plan Dive 20x/s
We were updating quite a lot of times the dive, we really didn't need to. this will help, but not fix, the issues with Plan / Add dive. Signed-off-by: Tomaz Canabrava <[email protected]> --- 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 44ca6ba..2ee1684 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<ProfileWidget2*>(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 e6ae8e8..4093bac 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" -- 2.2.2
From 06d4e013119bc9cfd9f1423e1f96d0ec558d645a Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava <[email protected]> Date: Sun, 18 Jan 2015 19:17:24 -0200 Subject: [PATCH 2/2] fix extreme sluggish Profile over time Whoa, this deserves a good explanation. Everytime that the mouse moved in Add mode / Plan mode, or anytime a new dive was displayed on the Profile, this method would be called and connect the dataModel to the modelChanged method. This added the slot in a call-vector that the fired signal would call, adding one call to the SLOt per ADD / PLAN mouse move ( about 20x/s ) or each time a new dive was displayed. Quicly filling the vector with more than 200 - 300 calls to this same SLOT. The fix is to only connect one time. this made the ADD / PLAN mode *so* much smooth... :) Signed-off-by: Tomaz Canabrava <[email protected]> --- qt-ui/profile/tankitem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qt-ui/profile/tankitem.cpp b/qt-ui/profile/tankitem.cpp index 48b586d..c0e75a3 100644 --- a/qt-ui/profile/tankitem.cpp +++ b/qt-ui/profile/tankitem.cpp @@ -50,7 +50,7 @@ void TankItem::setData(DivePlotDataModel *model, struct plot_info *plotInfo, str memcpy(pInfoEntry, plotInfo->entry, size); copy_cylinders(d, &diveCylinderStore, false); dataModel = model; - connect(dataModel, SIGNAL(dataChanged(QModelIndex, QModelIndex)), this, SLOT(modelDataChanged(QModelIndex, QModelIndex))); + connect(dataModel, SIGNAL(dataChanged(QModelIndex, QModelIndex)), this, SLOT(modelDataChanged(QModelIndex, QModelIndex)), Qt::UniqueConnection); modelDataChanged(); } -- 2.2.2
_______________________________________________ subsurface mailing list [email protected] http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
