PDA

View Full Version : Problem with modal QProgressDialog



esterbonmati
15th January 2009, 12:36
I have a problem with a modal QProgressDialog.

In my application I need a QProgessDialog, but this dialog is activated by a context menu.

When I click in the context menu, then appears the de modal dialog. I recive the QEvent::MouseButtonPress when I click in the context menu, but I don't recive the QEvent::MouseButtonRelease. I think that the modal dialog block the QEvent::MouseButtonRelease.

I need to recive the QEvent::MouseButtonRelease. Is it possible?

Thanks, and sorry for my English

faldzip
15th January 2009, 12:59
if it's QProgressDialog receiving that event (and stopping it), you can subclass QProgressDialog and override event(QEvent *event) method like this:


bool MyProgressDialog::event(QEvent *e)
{
if (e->type() == QEvent::MouseButtonRelease)
{
QApplication::sendEvent(parent, e);
return true;
}
return QProgressDialog::event(e);
}

where parent of your dialog is the object where you want that event to receive. If not, you can pass a pointer to object via constructor.