mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 21:43:23 +00:00
Only update the rectangle if it changed
Very often the rectangle of the ToolTip doesn't need to change but we were calling and firing an animation for it for *every* mouse movement, even when we didn't really needed it. Now it will only fire something if the rectangles are indeed different. From my tests we reduced the number of calls to the animatior by about 20% using a real divelog as test. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
54898b15ff
commit
806d984107
1 changed files with 7 additions and 5 deletions
|
@ -126,11 +126,13 @@ void ToolTipItem::expand()
|
|||
nextRectangle.setWidth(width);
|
||||
nextRectangle.setHeight(height);
|
||||
|
||||
QPropertyAnimation *animation = new QPropertyAnimation(this, "rect", this);
|
||||
animation->setDuration(100);
|
||||
animation->setStartValue(rectangle);
|
||||
animation->setEndValue(nextRectangle);
|
||||
animation->start(QAbstractAnimation::DeleteWhenStopped);
|
||||
if (nextRectangle != rectangle) {
|
||||
QPropertyAnimation *animation = new QPropertyAnimation(this, "rect", this);
|
||||
animation->setDuration(100);
|
||||
animation->setStartValue(rectangle);
|
||||
animation->setEndValue(nextRectangle);
|
||||
animation->start(QAbstractAnimation::DeleteWhenStopped);
|
||||
}
|
||||
|
||||
status = EXPANDED;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue