Results 1 to 4 of 4

Thread: Check if there is message handler

  1. #1
    Join Date
    Oct 2008
    Posts
    29
    Qt products
    Qt4
    Platforms
    Windows

    Default Check if there is message handler

    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.

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Check if there is message handler

    qInstallMsgHandler returns the previous installed one. You can check if that one exists and then reset.

  3. #3
    Join Date
    Oct 2008
    Posts
    29
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Check if there is message handler

    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

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Check if there is message handler

    Qt Code:
    1. QtMsgHandler handler = qInstallMsgHandler(myHandler);
    2. if(handler)
    3. qInstallMsgHandler(handler);
    To copy to clipboard, switch view to plain text mode 
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Qt PDF image handler
    By wysota in forum Qt-based Software
    Replies: 0
    Last Post: 5th April 2009, 09:37
  2. mouse handler
    By ahmedKhaled in forum Qt Programming
    Replies: 0
    Last Post: 3rd February 2009, 08:44
  3. Replies: 4
    Last Post: 12th October 2008, 13:47
  4. event handler
    By mattia in forum Newbie
    Replies: 10
    Last Post: 8th November 2007, 12:54
  5. Message handler question
    By bruccutler in forum Newbie
    Replies: 10
    Last Post: 19th May 2007, 21:26

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.