Removed use of a weakPointer for storing the glowAnimation in buttons:

it is unnecessary since the object is never accessed outside of the button class, is a child and the button, and thus destroyed 
only in the button destructor, by Qt. 


svn path=/trunk/KDE/kdebase/workspace/; revision=1170321
This commit is contained in:
Hugo Pereira Da Costa 2010-08-31 14:18:02 +00:00
parent b8137a7671
commit 1a1d2b964b
2 changed files with 22 additions and 17 deletions

View file

@ -65,11 +65,11 @@ namespace Oxygen
setToolTip(tip); setToolTip(tip);
// setup animation // setup animation
glowAnimation().data()->setStartValue( 0 ); glowAnimation()->setStartValue( 0 );
glowAnimation().data()->setEndValue( 1.0 ); glowAnimation()->setEndValue( 1.0 );
glowAnimation().data()->setTargetObject( this ); glowAnimation()->setTargetObject( this );
glowAnimation().data()->setPropertyName( "glowIntensity" ); glowAnimation()->setPropertyName( "glowIntensity" );
glowAnimation().data()->setEasingCurve( QEasingCurve::InOutQuad ); glowAnimation()->setEasingCurve( QEasingCurve::InOutQuad );
// setup connections // setup connections
reset(0); reset(0);
@ -107,7 +107,7 @@ namespace Oxygen
//___________________________________________________ //___________________________________________________
void Button::reset( unsigned long ) void Button::reset( unsigned long )
{ glowAnimation().data()->setDuration( client_.configuration().animationsDuration() ); } { glowAnimation()->setDuration( client_.configuration().animationsDuration() ); }
//___________________________________________________ //___________________________________________________
@ -119,8 +119,8 @@ namespace Oxygen
if( animateButtonHover() ) if( animateButtonHover() )
{ {
glowAnimation().data()->setDirection( Animation::Forward ); glowAnimation()->setDirection( Animation::Forward );
if( !isAnimated() ) glowAnimation().data()->start(); if( !isAnimated() ) glowAnimation()->start();
} else update(); } else update();
@ -134,8 +134,8 @@ namespace Oxygen
if( status_ == Oxygen::Hovered && animateButtonHover() ) if( status_ == Oxygen::Hovered && animateButtonHover() )
{ {
glowAnimation().data()->setDirection( Animation::Backward ); glowAnimation()->setDirection( Animation::Backward );
if( !isAnimated() ) glowAnimation().data()->start(); if( !isAnimated() ) glowAnimation()->start();
} }
status_ = Oxygen::Normal; status_ = Oxygen::Normal;

View file

@ -80,11 +80,6 @@ namespace Oxygen
//!@name glow animation //!@name glow animation
//@{ //@{
//! return animation object
virtual const Animation::Pointer& glowAnimation() const
{ return glowAnimation_; }
void setGlowIntensity( qreal value ) void setGlowIntensity( qreal value )
{ {
if( glowIntensity_ == value ) return; if( glowIntensity_ == value ) return;
@ -99,6 +94,15 @@ namespace Oxygen
protected: protected:
//!@name glow animation
//@{
//! return animation object
Animation* glowAnimation() const
{ return glowAnimation_; }
//@}
//! press event //! press event
void mousePressEvent(QMouseEvent* ); void mousePressEvent(QMouseEvent* );
@ -130,7 +134,7 @@ namespace Oxygen
//! true if animation is in progress //! true if animation is in progress
bool isAnimated( void ) const bool isAnimated( void ) const
{ return glowAnimation().data()->isRunning(); } { return glowAnimation()->isRunning(); }
//! true if button is active //! true if button is active
bool isActive( void ) const; bool isActive( void ) const;
@ -177,7 +181,8 @@ namespace Oxygen
bool forceInactive_; bool forceInactive_;
//! glow animation //! glow animation
Animation::Pointer glowAnimation_; //Animation::Pointer glowAnimation_;
Animation* glowAnimation_;
//! glow intensity //! glow intensity
qreal glowIntensity_; qreal glowIntensity_;