summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2015-01-16 16:29:07 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-01-17 08:05:48 +1300
commit85909ca28d4a14e079908123c4eb00201278fe24 (patch)
treefc39c17eb5180ac1c206b82a62a8afa61c85761c /qt-ui
parent85a3cbf8af3ac19495572c96be167539660a8ca4 (diff)
downloadsubsurface-85909ca28d4a14e079908123c4eb00201278fe24.tar.gz
Reduce the number of calls to boundingRect
There are a few calculations that go on boundingRect that can be avoided if we simply store the result. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/profile/divetooltipitem.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/qt-ui/profile/divetooltipitem.cpp b/qt-ui/profile/divetooltipitem.cpp
index db2bd1f02..b07c72976 100644
--- a/qt-ui/profile/divetooltipitem.cpp
+++ b/qt-ui/profile/divetooltipitem.cpp
@@ -89,15 +89,17 @@ void ToolTipItem::expand()
double width = 0, height = title->boundingRect().height() + iconMetrics.spacing;
Q_FOREACH (const ToolTip& t, toolTips) {
- if (t.second->boundingRect().width() > width)
- width = t.second->boundingRect().width();
- height += t.second->boundingRect().height();
+ QRectF sRect = t.second->boundingRect();
+ if (sRect.width() > width)
+ width = sRect.width();
+ height += sRect.height();
}
if (entryToolTip.first) {
- if (entryToolTip.second->boundingRect().width() > width)
- width = entryToolTip.second->boundingRect().width();
- height += entryToolTip.second->boundingRect().height();
+ QRectF sRect = entryToolTip.second->boundingRect();
+ if (sRect.width() > width)
+ width = sRect.width();
+ height += sRect.height();
}
/* Left padding, Icon Size, space, right padding */
@@ -166,7 +168,7 @@ void ToolTipItem::updateTitlePosition()
setRect(newRect);
}
- title->setPos(boundingRect().width() / 2 - title->boundingRect().width() / 2 - 1, 0);
+ title->setPos(rect().width() / 2 - title->boundingRect().width() / 2 - 1, 0);
}
bool ToolTipItem::isExpanded() const