1 /***************************************************************************
2 * Copyright (c) 2007 Nikolaj Hald Nielsen <nhnFreespirit@gmail.com> *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA. *
18 ***************************************************************************/
20 #ifndef GRAPHICSITEMFADER_H
21 #define GRAPHICSITEMFADER_H
24 #include <QGraphicsPixmapItem>
25 #include <QGraphicsRectItem>
33 A simple "widget" for the context view that provides a fading image
34 Will be ported to use QGraphicsSvgItem once that successfully renders
37 @author Nikolaj Hald Nielsen <nhnFreespirit@gmail.com>
39 class GraphicsItemFader
: public QObject
, public QGraphicsItem
44 explicit GraphicsItemFader( QGraphicsItem
* item
, QGraphicsItem
* parent
= 0 );
47 virtual QRectF
boundingRect () const;
48 void paint(QPainter
*painter
, const QStyleOptionGraphicsItem
*option
, QWidget
*widget
);
50 void setFadeColor( const QColor
&color
);
51 void setStartAlpha( int alpha
);
52 void setTargetAlpha( int alpha
);
53 void setDuration( int ms
);
54 void setFPS( int fps
);
56 QGraphicsItem
* contentItem() { return m_contentItem
; }
59 void animationComplete();
62 void fadeSlot( int step
);
66 QTimeLine
* m_timeLine
;
67 QGraphicsItem
* m_contentItem
;
68 QGraphicsRectItem
* m_shadeRectItem
;
69 QGraphicsItem
* m_itemPreviousParent
;