From 34376c31b1922c15ab85b9f736d7455eb68e0176 Mon Sep 17 00:00:00 2001 From: Aaron Seigo Date: Fri, 2 Dec 2011 10:39:18 +0100 Subject: [PATCH] animate transitions when an svg is used as well. --- widgets/iconwidget.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/widgets/iconwidget.cpp b/widgets/iconwidget.cpp index 4df937eb7..3aed39067 100644 --- a/widgets/iconwidget.cpp +++ b/widgets/iconwidget.cpp @@ -650,15 +650,25 @@ void IconWidget::setSvg(const QString &svgFilePath, const QString &elementId) if (!d->iconSvg) { d->iconSvg = new Plasma::Svg(this); connect(d->iconSvg, SIGNAL(repaintNeeded()), this, SLOT(svgChanged())); + d->oldIcon = d->icon; + } else { + d->oldIcon = d->iconSvg->pixmap(d->iconSvgElement); } d->iconSvg->setImagePath(svgFilePath); d->iconSvg->setContainsMultipleImages(!elementId.isNull()); d->iconSvgElement = elementId; d->iconSvgElementChanged = true; - d->icon = QIcon(); updateGeometry(); - update(); + + if (!(d->states & IconWidgetPrivate::HoverState) && !d->iconChangeTimer->isActive() && !d->oldIcon.isNull()) { + d->animateMainIcon(true, d->states); + } else { + d->oldIcon = QIcon(); + update(); + } + d->iconChangeTimer->start(300); + d->icon = QIcon(); } QString IconWidget::svg() const