aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Lubomir I. Ivanov <neolit123@gmail.com>2013-07-05 15:33:50 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-07-05 07:38:27 -0700
commit2e26de5ae6bd3300153be89de080d12f4c60cfcf (patch)
tree3a3910bb6666c6da4067dccaa3f5e6948bdee32f
parent3b07cd204bc79eea7ab8b9a872d8abd83b0a2cbb (diff)
downloadsubsurface-2e26de5ae6bd3300153be89de080d12f4c60cfcf.tar.gz
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 <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-ui/profilegraphics.cpp6
-rw-r--r--qt-ui/profilegraphics.h1
2 files changed, 2 insertions, 5 deletions
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)
diff --git a/qt-ui/profilegraphics.h b/qt-ui/profilegraphics.h
index 48c88aaca..b6df52dec 100644
--- a/qt-ui/profilegraphics.h
+++ b/qt-ui/profilegraphics.h
@@ -54,6 +54,7 @@ private:
Status status;
QRectF rectangle;
bool dragging;
+ QRectF nextRectangle;
};
class EventItem : public QGraphicsPolygonItem