source: trunk/demos/qtdemo/demoitemanimation.h@ 280

Last change on this file since 280 was 2, checked in by Dmitry A. Kuminov, 16 years ago

Initially imported qt-all-opensource-src-4.5.1 from Trolltech.

File size: 3.3 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4** Contact: Qt Software Information ([email protected])
5**
6** This file is part of the demonstration applications of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial Usage
10** Licensees holding valid Qt Commercial licenses may use this file in
11** accordance with the Qt Commercial License Agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and Nokia.
14**
15** GNU Lesser General Public License Usage
16** Alternatively, this file may be used under the terms of the GNU Lesser
17** General Public License version 2.1 as published by the Free Software
18** Foundation and appearing in the file LICENSE.LGPL included in the
19** packaging of this file. Please review the following information to
20** ensure the GNU Lesser General Public License version 2.1 requirements
21** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
22**
23** In addition, as a special exception, Nokia gives you certain
24** additional rights. These rights are described in the Nokia Qt LGPL
25** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
26** package.
27**
28** GNU General Public License Usage
29** Alternatively, this file may be used under the terms of the GNU
30** General Public License version 3.0 as published by the Free Software
31** Foundation and appearing in the file LICENSE.GPL included in the
32** packaging of this file. Please review the following information to
33** ensure the GNU General Public License version 3.0 requirements will be
34** met: http://www.gnu.org/copyleft/gpl.html.
35**
36** If you are unsure which license is appropriate for your use, please
37** contact the sales department at [email protected].
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42#ifndef DEMO_ITEM_ANIMATION_H
43#define DEMO_ITEM_ANIMATION_H
44
45#include <QtCore>
46#include <QtGui>
47
48class DemoItem;
49
50class DemoItemAnimation : public QGraphicsItemAnimation
51{
52 Q_OBJECT
53
54public:
55 enum INOROUT {ANIM_IN, ANIM_OUT, ANIM_UNSPECIFIED};
56
57 DemoItemAnimation(DemoItem *item, INOROUT inOrOut = ANIM_UNSPECIFIED);
58 virtual ~DemoItemAnimation();
59
60 virtual void play(bool fromStart = true, bool force = false);
61 virtual void playReverse();
62 virtual void stop(bool reset = true);
63 virtual void setRepeat(int nr = 0);
64
65 void setDuration(int duration);
66 void setDuration(float duration){ setDuration(int(duration)); };
67 void setOpacityAt0(qreal opacity);
68 void setOpacityAt1(qreal opacity);
69 void setOpacity(qreal step);
70 void setCurrentTime(int ms);
71 void setStartPos(const QPointF &pos);
72 bool notOwnerOfItem();
73
74 bool running();
75 bool runningOrItemLocked();
76 void lockItem(bool state);
77 void prepare();
78
79 DemoItem *demoItem();
80
81 virtual void afterAnimationStep(qreal step); // overridden
82
83 QTimeLine *timeline;
84 qreal opacityAt0;
85 qreal opacityAt1;
86 int startDelay;
87 QPointF startPos;
88 bool hideOnFinished;
89 bool moveOnPlay;
90 bool forcePlay;
91 bool fromStart;
92 INOROUT inOrOut;
93
94private slots:
95 virtual void playWithoutDelay();
96};
97
98#endif // DEMO_ITEM_ANIMATION_H
99
100
101
Note: See TracBrowser for help on using the repository browser.