[Development] Allowing event delivery prior to and after QCoreApplication

Thiago Macieira thiago.macieira at intel.com
Wed Apr 15 17:20:31 CEST 2015


On Wednesday 15 April 2015 11:56:04 André Somers wrote:
> We use it in our applications. It is used indeed as a catch-all
> exception handler (I'm not a fan, but ok), but a useful use we also have
> that we use it as a debug device to get more insight into what events
> are send around the system, monitoring a set of objects and a set of
> event types and outputting them. Sure, that's not a common use case and
> can be done differently, but we have used/abused notifiy for these.

Thanks André. The above contains two use-cases for overriding notify():

1) catching exceptions, logging and resuming work
2) debugging / inspecting events

QGuiApplication does the 2nd case by allowing the QPlatformWindow to inspect 
events sent to QWindow objects. They don't stop or modify the event in any 
way. QApplication itself has a third usecase. Well, I think it does, because 
it's a 680-line function I don't understand.

Either way, both are only for objects in the main thread.

Anyway, for debugging events, I'd say GammaRay is your solution. You shouldn't 
have to override a virtual and do your own logging if GammaRay does it for 
you.

As for the catching exceptions, we can provide that as a application-global 
toggle. We could also allow setting QT_FATAL_EXCEPTIONS to make the printing 
fatal and stop execution cleanly.
-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Development mailing list