March 21, 2012

Giorgos Tsiapaliokas Giorgos Tsiapaliokas
Lab Rat
67 posts

[SOLVED] capture the output of a class

 

Hello,

I have the following code,

  1. void Hello::sayHello()
  2. {
  3. qDebug() << "foo";
  4. someOtherObject->aMethodWhichPrintsSomethingInSTDOUT();
  5. }

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

 Signature 

terietor.gr

4 replies

March 21, 2012

Andre Andre
Robot Herder
6296 posts

Were you looking for the qInstallMsgHandler() function?

 Signature 

Looking for Qt developers to join our team @ i-Optics: https://qt-project.org/forums/viewthread/25393/

March 23, 2012

Giorgos Tsiapaliokas Giorgos Tsiapaliokas
Lab Rat
67 posts
Andre wrote:
Were you looking for the qInstallMsgHandler() function?

Not exactly.

qinstallMsgHandler can give me the output from a function like,

  1. 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?

 Signature 

terietor.gr

March 23, 2012

Andre Andre
Robot Herder
6296 posts

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

 Signature 

Looking for Qt developers to join our team @ i-Optics: https://qt-project.org/forums/viewthread/25393/

March 24, 2012

Giorgos Tsiapaliokas Giorgos Tsiapaliokas
Lab Rat
67 posts

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

thanks

 Signature 

terietor.gr

 
  ‹‹ Problem using overridden methods      How to ensure comparison operator is "complete"? ››

You must log in to post a reply. Not a member yet? Register here!