[SOLVED] capture the output of a class

  • Hello,

    I have the following code,

    void Hello::sayHello()
    qDebug() << "foo";

    I want to capture the following output in qwidget like qtcreator does.
    The above code isn't a separate application, it lives in same application
    in which i want to print the output into the qwidget.

    Any hints?

    thanks in advance

  • Were you looking for the qInstallMsgHandler() function?

  • [quote author="Andre" date="1332332839"]Were you looking for the qInstallMsgHandler() function?[/quote]

    Not exactly.

    qinstallMsgHandler can give me the output from a function like,

    @void myMessageOutput(QtMsgType type, const char *msg)@

    My debug output doesn't come from methods like this, but it comes from the qDebug macro.
    Is there a way to capture that output?

  • I think you misunderstand what these message handlers really do. All the output from qDebug, qWarning and qFatal passes through this function.

  • I played today with the above and i figure it out.


Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.