I am not at work right now, but I can reproduce it:
bool MyWidget
::event( QEvent *e
) {
if( e
->type
() == QEvent::User ) {
MyEvent *customEvent = dynamic_cast<MyEvent*>(e);
if( customEvent && mProgressDlg )
{
if( customEvent->id == MyEvent::eUpdateProgress )
mProgressDlg->setValue( customEvent->progressValue );
else if( customEvent->id == MyEvent::eDone )
{
mProgressDlg->reset();
delete mProgressDlg;
mProgressDlg = NULL;
// ... Other code
}
e->accept();
return true;
}
}
return false;
}
bool MyWidget::event( QEvent *e )
{
if( e->type() == QEvent::User )
{
MyEvent *customEvent = dynamic_cast<MyEvent*>(e);
if( customEvent && mProgressDlg )
{
if( customEvent->id == MyEvent::eUpdateProgress )
mProgressDlg->setValue( customEvent->progressValue );
else if( customEvent->id == MyEvent::eDone )
{
mProgressDlg->reset();
delete mProgressDlg;
mProgressDlg = NULL;
// ... Other code
}
e->accept();
return true;
}
}
return false;
}
To copy to clipboard, switch view to plain text mode
mProgressDlg is of type QProgressDialog* and is created with:
mProgressDlg->setMinimumDuration( 2000 );
mProgressDlg->setValue( 0 );
mProgressDlg->setAutoClose( true );
mProgressDlg = new QProgressDialog( "...", "...", 0, 100, mainWindow, 0 );
mProgressDlg->setMinimumDuration( 2000 );
mProgressDlg->setValue( 0 );
mProgressDlg->setAutoClose( true );
To copy to clipboard, switch view to plain text mode
where mainWindow is a pointer to my app QMainWindow. Does QProgressDialog posts some events (maybe QTimerEvent's ?? ) to it's parent event queue?
So, this is a minimal version of the code. I hope I didn't forget anything.
Thanks.
Bookmarks