PDA

View Full Version : Reimplementing QApplication::notify()



Doug Broadwell
7th June 2007, 00:35
(C++ newbe also) I have code in my event handlers that throw errors. I would like to reimplement QApplication::notify() to be able to catch any thrown errors that I don't explicitly throw to deal with somewhat more gracefully than aborting the program.

Does anyone have an example code to do this?

Thanks,
Doug Broadwell

wysota
7th June 2007, 10:02
How about just calling the base implementation sourrounded in a try-catch block?

Doug Broadwell
7th June 2007, 17:02
Do you mean like:

try {
app.exec;
} catch( ... ) {
...
}

This won't work, and right now everything is event driven so I don't think there is a single place (other than app::notify()) where it could be done (???).

wysota
13th June 2007, 07:53
No, I mean:

bool MyApplication::notify(...){
try {
return QApplication::notify(...)
} catch(...){
...
}
}