perf: do not touch graphic scene when it's not necessary

Change-Id: I8f4901ce96cc92a73b5d73e4fe8e90d5f1155a81
This commit is contained in:
Hualet Wang 2018-05-08 18:01:15 +08:00
parent 94fc261e62
commit 373fe4434e
Notes: gerrit 2018-05-09 14:05:43 +08:00
Verified+1: Anonymous Coward #1000004
Code-Review+2: sbwtw <sbw@sbw.so>
Submitted-by: sbwtw <sbw@sbw.so>
Submitted-at: Wed, 09 May 2018 14:05:43 +0800
Reviewed-on: https://cr.deepin.io/34434
Project: dde/dde-dock
Branch: refs/heads/master

View File

@ -641,6 +641,13 @@ void AppItem::playSwingEffect()
void AppItem::stopSwingEffect()
{
// NOTE(hualet): return immediatly if animation is not running,
// because operations on QGraphicsScenes are very expensive,
// especially when we do one of startSwingEffect/stopSwingEffect
// in updateWindowInfos which happens very often.
if (!m_swingEffectView->isVisible())
return;
// stop swing effect
m_swingEffectView->setVisible(false);