Yes, like that.
So your constructor would be like so:
{
this->yourData = yourData; // etc...
}
myEvent::myEvent(int yourData) : QEvent(QEvent::User)
{
this->yourData = yourData; // etc...
}
To copy to clipboard, switch view to plain text mode
and then:
bool myThread
::event( QEvent * e
) {
if (e
->type
() >
= QEvent::User) {
myEvent *e = static_cast<myEvent*>(e);
(...)
bool myThread::event( QEvent * e )
{
if (e->type() >= QEvent::User)
{
myEvent *e = static_cast<myEvent*>(e);
(...)
To copy to clipboard, switch view to plain text mode
As stated in the documentation, you must not access the object again once it has been posted:
The event must be allocated on the heap since the post event queue will take ownership of the event and delete it once it has been posted. It is not safe to access the event after it has been posted.
Bookmarks