summaryrefslogtreecommitdiffstats
path: root/qt-ui/profile/profilewidget2.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2014-05-26 17:51:46 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-05-26 14:07:27 -0700
commitaddec6b69fe9022a79d83945b865a0b518f556e8 (patch)
treea5c4a34fc28026c1f94f8a0a3539e37520362a63 /qt-ui/profile/profilewidget2.cpp
parentfe2eb1a9fc70e8aa2eae7c87cd8f16c753a6735d (diff)
downloadsubsurface-addec6b69fe9022a79d83945b865a0b518f556e8.tar.gz
Do not set maxTime when the handler is moving.
Fixes massive cpu hog. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/profile/profilewidget2.cpp')
-rw-r--r--qt-ui/profile/profilewidget2.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index 28a07404f..f62299648 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -87,7 +87,8 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) : QGraphicsView(parent),
heartBeatItem(new DiveHeartrateItem()),
rulerItem(new RulerItem2()),
isGrayscale(false),
- printMode(false)
+ printMode(false),
+ shouldCalculateMaxTime(true)
{
memset(&plotInfo, 0, sizeof(plotInfo));
@@ -421,7 +422,8 @@ void ProfileWidget2::plotDives(QList<dive *> dives)
*/
struct plot_info pInfo = calculate_max_limits_new(d, currentdc);
create_plot_info_new(d, currentdc, &pInfo);
- int maxtime = get_maxtime(&pInfo);
+ if(shouldCalculateMaxTime)
+ maxtime = get_maxtime(&pInfo);
int maxdepth = get_maxdepth(&pInfo);
dataModel->setDive(d, pInfo);
@@ -546,6 +548,22 @@ void ProfileWidget2::resizeEvent(QResizeEvent *event)
fixBackgroundPos();
}
+void ProfileWidget2::mousePressEvent(QMouseEvent *event)
+{
+ QGraphicsView::mousePressEvent(event);
+ if(currentState == PLAN)
+ shouldCalculateMaxTime = false;
+}
+
+void ProfileWidget2::mouseReleaseEvent(QMouseEvent *event)
+{
+ QGraphicsView::mouseReleaseEvent(event);
+ if(currentState == PLAN){
+ shouldCalculateMaxTime = true;
+ replot();
+ }
+}
+
void ProfileWidget2::fixBackgroundPos()
{
if (currentState != EMPTY)