[Qt-creator] Capture Application Output via Plugin
Christian Kandeler
christian.kandeler at qt.io
Thu May 6 16:44:35 CEST 2021
On 5/6/21 4:23 PM, Daniel Engelke wrote:
>
> I want to process the application output (find errors during runtime,
> stats, etc.).
>
> The “from” is an external plugin implementing ExtensionSystem::IPlugin.
>
Step 1: Subclass Utils::OutputLineParser and override the handleLine()
function. This gives you the application output, line by line. Pass it
on to your business logic and return Status::NotHandled.
Step 2: Subclass ProjectExplorer::OutputFormatterFactory. In the
constructor, do something like this:
setFormatterCreator([](Target *t) -> QList<OutputLineParser *> {
return {new MyOutputParser};
});
Step 3: Instantiate this factory class somewhere "persistent", e.g. as a
member of your Plugin class.
That should be it.
All of this assumes that you do not have your own RunConfiguration
subclass, but you really want to capture any run control's output.
Christian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qt-creator/attachments/20210506/3085d9bf/attachment.html>
More information about the Qt-creator
mailing list