I'm building my own custom event and I want to just put this out there to
see if anyone is offended by the way I use the registerEventType function
(since I can't find any specific info on how to use it). I think it make
sense... but I've never casted a new value into a predefined enum... and I
fear change.
ShapeAnimationEvent.h:
#ifndef SHAPE_ANIMATION_EVENT_H
#define SHAPE_ANIMATION_EVENT_H
#include <QEvent>
#include <QVariant>
class ShapeAnimationEvent : public QEvent
{
public:
static const QEvent::Type JUMP_TO_TIME;
ShapeAnimationEvent(QEvent::Type type, QVariant data);
QVariant data() const;
private:
QVariant m_data;
};
#endif
ShapeAnimationEvent.cpp:
#include "ShapeAnimationEvent.h"
const QEvent::Type ShapeAnimationEvent::JUMP_TO_TIME =
(QEvent::Type)QEvent::registerEventType();
ShapeAnimationEvent::ShapeAnimationEvent(QEvent::Type type, QVariant data) :
QEvent(type), m_data(data)
{
}
QVariant ShapeAnimationEvent::data() const
{
return m_data;
}
Thanks,
Brian!