[Qt-creator] Custom lines formatting in Compile Output

Mateusz Loskot mateusz at loskot.net
Mon Dec 9 10:13:38 CET 2013


On 9 December 2013 08:12, Petar Perisin <petar.perisin at gmail.com> wrote:
> There was recent addon: AnsiEscapeCodeHandler.
>
> You can look into it, to see how to change text format..
> in the same way you can implement your own formatter.

I looked briefly at this [1], but that could be useful as realisation of
actual formatting for certain needs.

[1] http://doc-snapshot.qt-project.org/qtcreator-extending/utils-ansiescapecodehandler.html

What I'm looking for is a way to customise formatting for the chain
of calls that starts at emitted addOutput from here

void AbstractProcessStep::stdOutput(const QString &line)
{
    if (m_outputParserChain)
        m_outputParserChain->stdOutput(line);
    emit addOutput(line, BuildStep::NormalOutput, BuildStep::DontAppendNewline);
}

and received in CompileOutputWindow::appendText
which next calls OutputWindow::appendText.

Initially, I thought I can do
CompileOutputWindow::outputWidget()->setFormatter(mycustomformatter)
that could be hooked by OutputWindow::appendMessage,
Then, I could recognise some custom format markers for
OutputFormat::NormlMessageFormat kind of lines.

But, the appendMessage seems never called for outputting Build lines.

Long story short, I would like to add colorise some lines
that my custom IOutputParser recognises.

If that is not possible, I will try to create tasks for those lines (events),
that that is less convenient for my case as it seems that:
1) The task list in the Issues pane is not a 'grid' that could be
sorted by type, file
2) Or, there is no way, for tasks in "Compile" category, apply
some finer filtering. The only available is on/off for warnings.

In my case, build output can contain
- build errors
- build warnings
- compile-time testing status (fail/pass)
- run-time testing status (fail/pass)

and I'd like to visually distinguish output for the last two kinds,
either in "Compile Output" view directly or in the "Issues" list.

If it makes sense, perhaps there is a way to achieve this.

Best regards,
-- 
Mateusz  Łoskot, http://mateusz.loskot.net



More information about the Qt-creator mailing list