From 633dd64d2fa18b64fd13a593019a42316c1de775 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Wed, 14 Jan 2015 12:52:23 -0200 Subject: [PATCH] Major speedup when moving the mouse in the profile After looking with great care at the result of the mouse movement on the profile, and also playing a bit with callgrind I've found out that one thing that we were doing wrong was the way we looked at the items in the scene, by calling scene()->items with Qt::ItemIntersectsShape, our shapes are very complex curves with thousends of points and we have lots of them. and it usually doesn't matter because *most* of the time we are getting the tooltip information from 'get_plot_details_new', so no accessing to items was necessary. By changing the access from Qt::ItemIntersectsShape to Qt::IntersectsItemBoundingRect we had a speedup of almost 500x in a section of code that's very important, and the good thing, nothing bad happened because one of the only things that we are using this code is to get information from the events, not the curves. Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-ui/profile/divetooltipitem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qt-ui/profile/divetooltipitem.cpp b/qt-ui/profile/divetooltipitem.cpp index 78bdc71a1..7f7627309 100644 --- a/qt-ui/profile/divetooltipitem.cpp +++ b/qt-ui/profile/divetooltipitem.cpp @@ -264,7 +264,7 @@ void ToolTipItem::refresh(const QPointF &pos) } free_buffer(&mb); - Q_FOREACH (QGraphicsItem *item, scene()->items(pos, Qt::IntersectsItemShape + Q_FOREACH (QGraphicsItem *item, scene()->items(pos, Qt::IntersectsItemBoundingRect ,Qt::DescendingOrder, scene()->views().first()->transform())) { if (!item->toolTip().isEmpty()) addToolTip(item->toolTip());