From 2e26de5ae6bd3300153be89de080d12f4c60cfcf Mon Sep 17 00:00:00 2001 From: "Lubomir I. Ivanov" Date: Fri, 5 Jul 2013 15:33:50 +0300 Subject: Profile: improve tooltip animation Remove a couple of expand() calls(?). Also store the last expanded rectangle size in the private variable nextRectangle and use that in collapse() animation. Patch prevents a small jump/resize glitch if the user quickly hovers over and out of the profile while the tooltip is still resizing. Signed-off-by: Lubomir I. Ivanov Signed-off-by: Dirk Hohndel --- qt-ui/profilegraphics.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'qt-ui/profilegraphics.cpp') diff --git a/qt-ui/profilegraphics.cpp b/qt-ui/profilegraphics.cpp index 512b71549..43562f545 100644 --- a/qt-ui/profilegraphics.cpp +++ b/qt-ui/profilegraphics.cpp @@ -1198,8 +1198,6 @@ void ToolTipItem::removeToolTip(const QString& toolTip) t.second->setPos(SPACING + ICON_SMALL + SPACING, yValue); toolTipIndex++; } - - expand(); } void ToolTipItem::refresh(struct graphics_context *gc, QPointF pos) @@ -1225,7 +1223,6 @@ void ToolTipItem::clear() delete t.second; } toolTips.clear(); - expand(); } void ToolTipItem::setRect(const QRectF& r) @@ -1266,7 +1263,7 @@ void ToolTipItem::collapse() { QPropertyAnimation *animation = new QPropertyAnimation(this, "rect"); animation->setDuration(100); - animation->setStartValue(boundingRect()); + animation->setStartValue(nextRectangle); animation->setEndValue(QRect(0, 0, ICON_SMALL, ICON_SMALL)); animation->start(QAbstractAnimation::DeleteWhenStopped); clear(); @@ -1281,7 +1278,6 @@ void ToolTipItem::expand() return; } - QRectF nextRectangle; double width = 0, height = title->boundingRect().height() + SPACING; Q_FOREACH(ToolTip t, toolTips) { if (t.second->boundingRect().width() > width) -- cgit v1.2.3-70-g09d2