80 lines
2.3 KiB
C++
80 lines
2.3 KiB
C++
/*******************************************************************************
|
|
* *
|
|
* Société de Transports de Montréal. *
|
|
* 2012 *
|
|
* *
|
|
* Projet Zones Tests *
|
|
* *
|
|
* *
|
|
* *
|
|
*******************************************************************************/
|
|
/*
|
|
Description:
|
|
Description du fichier si nécessaire.
|
|
|
|
*/
|
|
|
|
/* ************************************************************************** */
|
|
/* Revision:
|
|
### 20131022 JFM
|
|
Verision d'origine.
|
|
|
|
### YYYYMMDD Description du besoin ou du bug
|
|
Description du changement.
|
|
*/
|
|
|
|
/* ************************************************************************** */
|
|
#include "GlobalDefine.h"
|
|
#include <QGraphicsWidget>
|
|
#include <QString>
|
|
#include <QTimeLine>
|
|
|
|
|
|
|
|
#ifndef EVENTITEM_H
|
|
#define EVENTITEM_H
|
|
|
|
class CEventItem : public QGraphicsWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
enum eEventColor
|
|
{
|
|
EVENT_ITEM_COLOR_RED,
|
|
EVENT_ITEM_COLOR_GREEN
|
|
};
|
|
|
|
|
|
CEventItem(QString Label,bool Animated,QGraphicsItem *Parent = 0, int Color = EVENT_ITEM_COLOR_RED);
|
|
~CEventItem();
|
|
|
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
|
unsigned int SetParameters(QString Label/*, unsigned int posx, unsigned int posy*/);
|
|
unsigned int SetState(unsigned int State);
|
|
unsigned int UpdateState();
|
|
void SetLabel(QString Label);
|
|
|
|
protected:
|
|
virtual void mouseReleaseEvent( QGraphicsSceneMouseEvent * event);
|
|
virtual void mousePressEvent ( QGraphicsSceneMouseEvent * event );
|
|
|
|
private:
|
|
QBrush *mCurBrush;
|
|
QString mLabel;
|
|
QFont mLabelFont;
|
|
bool mAnimated;
|
|
QTimeLine *mAnimationTimeline;
|
|
unsigned int mAlpha;
|
|
int mColor;
|
|
|
|
signals:
|
|
void EventItemRightClicked(CEventItem*);
|
|
|
|
public slots:
|
|
void UpdateAnimation(qreal);
|
|
void AnimationFinished();
|
|
};
|
|
|
|
#endif // EVENTITEM_H
|