class MyEvent : public QEvent{public: MyEvent( const QString & str ) : str_( str ) {}; QString str() { return str_; };private: QString str_;};
MyEvent * event = new MyEvent ( "string" );QCoreApplication::sendEvent ( someObject, event );
MyEvent * event = dynamic_cast < MyEvent * > ( ev );if( event ) event->str();
class MyEvent : public QEvent{public: MyEvent(int type, const QString& s) : QEvent(static_cast<Type>(type)), s(s) {}; const QString& str() { return s; }; private: QString s; };
myEvent e(QEvent::User + 1, "bla-bla-bla");QCoreApplication::sendEvent(Receiver, &e);
void Receiver::customEvent(QEvent* e) { MyEvent* event = dynamic_cast<MyEvent*>(e); if(event) QString s = event->str();}
CSISEvent *me = dynamic_cast<CSISEvent*>(e);
void Receiver::customEvent(QEvent* e) { if(e->type()==QEvent::User+1) { MyEvent* me = static_cast<MyEvent*>(e); QString s = me->str(); } }
CSISEvent *me = (CSISEvent*)e;