Na tej stronie

Utils::AnsiEscapeCodeHandler Class

class Utils::AnsiEscapeCodeHandler

Klasa AnsiEscapeCodeHandler analizuje tekst i wyodrębnia z niego kody escape ANSI. Więcej...

Header: #include <AnsiEscapeCodeHandler>

Szczegółowy opis

Aby zachować informacje o kolorach w poszczególnych segmentach tekstu, instancja tej klasy musi być przechowywana przez cały czas trwania strumienia. Ponadto jedna instancja tej klasy nie powinna obsługiwać wielu strumieni (przynajmniej nie w tym samym czasie).

Jej główną funkcją jest `parseText()`, która przyjmuje tekst oraz domyślny ` QTextCharFormat`. Funkcja ta służy do analizowania tekstu i dzielenia tekstu kolorowego na mniejsze ciągi znaków, z odpowiednimi informacjami o formatowaniu zapisanymi w ` QTextCharFormat`.

Sposób użycia:

  • Utwórz nową instancję klasy `AnsiEscapeCodeHandler` dla strumienia.
  • Aby dodać nowy tekst, należy wywołać funkcję parseText() z tekstem i domyślnym QTextCharFormat. Wynikiem działania tej funkcji jest lista ciągów znaków z formatami ustawionymi w odpowiednich QTextCharFormat.

Copyright © The Qt Company Ltd. and other contributors. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.