Home · All Namespaces · All Classes
Public Member Functions

TransformAnimation Class Reference

#include <transformlayoutanimation.h>

Inheritance diagram for TransformAnimation:
Inheritance graph
[legend]
Collaboration diagram for TransformAnimation:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 TransformAnimation (QGraphicsWidget *widget)
virtual ~TransformAnimation ()
 Destructor.
virtual void updateCurrentValue (const QVariant &value)
virtual void updateState (QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
QGraphicsWidget * widget () const
void setEndValue (const QRectF &rect)

Detailed Description

Animates a widget's translation and scale transform

Definition at line 31 of file transformlayoutanimation.h.


Constructor & Destructor Documentation

TransformAnimation::TransformAnimation ( QGraphicsWidget *  widget  ) 

Constructor

Parameters:
widget the widget to animate

Definition at line 22 of file transformlayoutanimation.cpp.

                                                              : animatedWidget(widget)
{
}

TransformAnimation::~TransformAnimation (  )  [virtual]

Destructor.

Definition at line 26 of file transformlayoutanimation.cpp.

{
}


Member Function Documentation

void TransformAnimation::setEndValue ( const QRectF &  rect  ) 

Sets the destination rectangle

Definition at line 35 of file transformlayoutanimation.cpp.

{
    invDestSize = QSizeF(1.0f / qMax(qreal(1.0f), rect.width()),
                         1.0f / qMax(qreal(1.0f), rect.height()));

    QVariantAnimation::setEndValue(rect);
}

void TransformAnimation::updateCurrentValue ( const QVariant &  value  )  [virtual]

REIMPLEMENTATION

Definition at line 43 of file transformlayoutanimation.cpp.

{
    QRectF  rect      = value.toRectF();
    QRectF  destRect  = endValue().toRectF();
    QPointF translate = rect.topLeft() - destRect.topLeft();
    QPointF scale     = QPointF(rect.size().width()  * invDestSize.width(),
                                rect.size().height() * invDestSize.height());

    animatedWidget->setTransform(QTransform::fromTranslate(translate.x(), translate.y()).scale(scale.x(), scale.y()));
}

virtual void TransformAnimation::updateState ( QAbstractAnimation::State  newState,
QAbstractAnimation::State  oldState 
) [virtual]
QGraphicsWidget * TransformAnimation::widget (  )  const

Returns the widget controlled by this animation

Definition at line 30 of file transformlayoutanimation.cpp.

{
    return animatedWidget;
}


The documentation for this class was generated from the following files:

Copyright © 2010 Nokia Corporation Generated on Thu Nov 4 2010 18:20:43
Doxygen 1.7.1
MeeGo Touch