ginebra/old/graphicsitemrotater.h
branchGCC_SURGE
changeset 8 2e16851ffecd
parent 2 bf4420e9fa4d
parent 6 1c3b8676e58c
equal deleted inserted replaced
2:bf4420e9fa4d 8:2e16851ffecd
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef GRAPHICSITEMROTATER_H
       
    20 #define GRAPHICSITEMROTATER_H
       
    21 
       
    22 #include <QObject>
       
    23 #include <QTimeLine>
       
    24 
       
    25 class QGraphicsPixmapItem;
       
    26 class QGraphicsItem;
       
    27 
       
    28 class GraphicsItemRotater : public QObject
       
    29 {
       
    30     Q_OBJECT
       
    31 
       
    32 public:
       
    33     GraphicsItemRotater();
       
    34     ~GraphicsItemRotater();
       
    35 
       
    36     void start(QGraphicsItem *item, int angle, int duration = 500, QTimeLine::CurveShape shape = QTimeLine::EaseOutCurve);
       
    37     void stop() { m_timeLine.stop(); }
       
    38 
       
    39 signals:
       
    40     void finished();
       
    41 
       
    42 protected slots:
       
    43     void updateRotationStep(qreal value);
       
    44 
       
    45 protected:
       
    46     void grabItem(QGraphicsItem *item, class QPainter *painter, const class QStyleOptionGraphicsItem *option, QWidget *widget = 0);
       
    47 
       
    48 protected:
       
    49     QGraphicsPixmapItem *m_pixmapItem;
       
    50     QTimeLine m_timeLine;
       
    51     int m_rotationAngle;
       
    52     qreal m_lastRotationValue;
       
    53 };
       
    54 
       
    55 #endif // GRAPHICSITEMROTATER_H