use opacity, not a qgraphicseffect, since an item can't have more than

one effect and the opacity property of the widget would lie.
if there will be graphics glitches it would be a qt problem that should
be resolved, not by a workaround

svn path=/trunk/KDE/kdelibs/; revision=1047550
This commit is contained in:
Marco Martin 2009-11-11 12:04:58 +00:00
parent c1ee933143
commit 47a6082bf5
2 changed files with 4 additions and 11 deletions

View File

@ -20,7 +20,6 @@
#include "fade_p.h"
#include <QRect>
#include <QtGui/QGraphicsOpacityEffect>
#include <kdebug.h>
@ -60,16 +59,12 @@ qreal FadeAnimation::targetOpacity() const
void FadeAnimation::setWidgetToAnimate(QGraphicsWidget *widget)
{
QGraphicsOpacityEffect *effect = m_opacityEffect.data();
delete effect;
Animation::setWidgetToAnimate(widget);
if (widget) {
effect = new QGraphicsOpacityEffect(widget);
effect->setOpacity(m_startOpacity);
widget->setGraphicsEffect(effect);
m_opacityEffect = effect;
widget->setOpacity(m_startOpacity);
m_widget = widget;
}
}
@ -78,7 +73,7 @@ QAbstractAnimation* FadeAnimation::render(QObject* parent)
//create animation
QPropertyAnimation* anim = dynamic_cast<QPropertyAnimation* >(animation());
if (!anim) {
anim = new QPropertyAnimation(m_opacityEffect.data(), "opacity", parent);
anim = new QPropertyAnimation(m_widget.data(), "opacity", parent);
setAnimation(anim);
}

View File

@ -27,8 +27,6 @@
#include <plasma/animations/animation.h>
#include <plasma/plasma_export.h>
class QGraphicsOpacityEffect;
namespace Plasma
{
@ -62,7 +60,7 @@ protected:
virtual QAbstractAnimation* render(QObject* parent = 0);
private:
QWeakPointer<QGraphicsOpacityEffect> m_opacityEffect;
QWeakPointer<QGraphicsWidget> m_widget;
qreal m_startOpacity;
qreal m_targetOpacity;
};