Thanks, Christian, that looks a lot cleaner.

 

Dan

 

From: Qt-creator <[email protected]> On Behalf Of Christian
Kandeler
Sent: Thursday, May 6, 2021 4:45 PM
To: [email protected]
Subject: Re: [Qt-creator] Capture Application Output via Plugin

 

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

_______________________________________________
Qt-creator mailing list
[email protected]
https://lists.qt-project.org/listinfo/qt-creator

Reply via email to