- setFlags(/*QGraphicsItem::ItemClipsToShape | */QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
- setTrack(info.track);
- m_startPos = info.startPos;
- m_cropDuration = info.endPos - info.startPos;
+}
+
+void AbstractClipItem::closeAnimation()
+{
+#if QT_VERSION >= 0x040600
+ if (!isEnabled()) return;
+ setEnabled(false);
+ setFlag(QGraphicsItem::ItemIsSelectable, false);
+ if (!(KGlobalSettings::graphicEffectsLevel() & KGlobalSettings::SimpleAnimationEffects)) {
+ // animation disabled
+ deleteLater();
+ return;
+ }
+ QPropertyAnimation *closeAnimation = new QPropertyAnimation(this, "rect");
+ QPropertyAnimation *closeAnimation2 = new QPropertyAnimation(this, "opacity");
+ closeAnimation->setDuration(200);
+ closeAnimation2->setDuration(200);
+ QRectF r = rect();
+ QRectF r2 = r;
+ r2.setLeft(r.left() + r.width() / 2);
+ r2.setTop(r.top() + r.height() / 2);
+ r2.setWidth(1);
+ r2.setHeight(1);
+ closeAnimation->setStartValue(r);
+ closeAnimation->setEndValue(r2);
+ closeAnimation->setEasingCurve(QEasingCurve::InQuad);
+ closeAnimation2->setStartValue(1.0);
+ closeAnimation2->setEndValue(0.0);
+ QParallelAnimationGroup *group = new QParallelAnimationGroup;
+ connect(group, SIGNAL(finished()), this, SLOT(deleteLater()));
+ group->addAnimation(closeAnimation);
+ group->addAnimation(closeAnimation2);
+ group->start(QAbstractAnimation::DeleteWhenStopped);
+#endif