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:
parent
c1ee933143
commit
47a6082bf5
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user