PDA

View Full Version : Check if there is message handler



Althor
13th July 2010, 08:20
Hi,

I want to install my own message handler to redirect stderr output to stdout but before install my message handler I would like to check if a message handler has been installed already.

is there any function to check it I could use?

Basically I want to do this:

if (there is not a message handler installed)
qInstallMsgHandler(myMessageOutput);

thanks in advance
regards.

tbscope
13th July 2010, 09:33
qInstallMsgHandler returns the previous installed one. You can check if that one exists and then reset.

Althor
13th July 2010, 10:31
I know, but I don´t want to call qinstallmsghandler if there is a message handler already. I don´t want to override the message handler installed

wysota
14th July 2010, 15:02
QtMsgHandler handler = qInstallMsgHandler(myHandler);
if(handler)
qInstallMsgHandler(handler);