0
votes

I have a hierarchy of Qt-based apps on Windows. One GUI app has started another console app (but without visible console window) via QProcess::startDetached. I would like to attach to this console app with debugger from the QtCreator. But after attaching I don't see any console output (the standard "Application output" tab Alt+3 is empty).

When I run console app separately from the QtCreator I see the "qtcreator_process_stub.exe console" which shows me all output.

Is there a way to see console output after attaching to the running process in my case, i.e. without restarting it as separate app?

1

1 Answers

1
votes

EDIT:

To get a QProcess output, it must be "part" of you app: this seems not possible using startDetached.


If, instead, you have an instance of QProcess in your GUI app, you can run the process using the start() method. At this point you can lean on the signals emitted when something is printed on standard output/error:

QProcess::readyReadStandardOutput()

QProcess::readyReadStandardError()

To get the text, connect them to a slot, and then invoke:

process->readAllStandardOutput()

process->readAllStandardError()