[Qt-creator] Custom lines formatting in Compile Output

Tobias Hunger tobias.hunger at digia.com
Mon Dec 9 10:01:59 CET 2013

On 09.12.2013 09:12, Petar Perisin 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'm not 100% sure,
> but you might be able to cast signal sender and in that way check if
> your parser was sender of that signal.

That will not work for IOutputParsers. They propagate their signals 
along the chain of parsers and through the buildmanager. The 
outputwindow gets all of them from the buildmanager, so trying to 
retrieve the sender will fail.

> On Sun, Dec 8, 2013 at 11:52 PM, Mateusz Loskot <mateusz at loskot.net
> <mailto:mateusz at loskot.net>> wrote:
>     I can't figure out how to customise format of lines appended by my
>     custom IOutputParser::stdError/stdOutput.

IOutputParsers are a very differet beast from the OutputFormaters. The 
former are meant to extract warning/error lines and do not do any 
formating. The latter obviously do.

>     For example, how can I print a line in green?

I am not sure we support this, yet in Compile Output. Basically the 
compile output is meant to be simple: Red lines are those we got from 
stderr, black lines those from stdout. That is all we do there.

>     Do I need to implement my own OutputFormatter and do setFormatter on
>     an output window, e.g. Compile Output?

No, those do not work on the Compile Output window AFAIR.

>     Could anyone help or point me where to look in QtC code to learn it?

Tobias Hunger, Senior Software Engineer - Digia, Qt
Digia Germany GmbH, Rudower Chaussee 13, D-12489 Berlin
Geschäftsführer: Mika Pälsi, Juha Varelius, Tuula Haataja
Sitz der Gesellschaft: Berlin. USt-IdNr: DE 286 306 868
Registergericht: Amtsgericht Charlottenburg, HRB 144331 B

More information about the Qt-creator mailing list