0

I pick text from bash and represent it in a QPlainTextEdit. The problem is that the code contains ascii colors ([01;31m) and these are printed in QT like characters, which is very ugly. How can I eliminate this colors or represent in the right way.

Sorry for my bad English.

Output example in QPlainTextEdit:

[0m[01m[K/home/aron/main.cpp:[m[K In function ‘[01m[Kint main()[m[K’:

SOLUTION:

std::string result = boost::regex_replace(text, boost::regex(R"(\x1B[([\d;])*(m|K))"), "");

Aron Wolf
  • 58
  • 1
  • 8
  • 1
    looks someone has already answered: http://stackoverflow.com/questions/26500429/qtextedit-and-colored-bash-like-output-emulation – Marco Oct 12 '15 at 16:50
  • Have the solution usign this lik: 'std::string result = boost::regex_replace(text, boost::regex(R"(\x1B[([\d;])*(m|K))"), ""); – Aron Wolf Oct 12 '15 at 17:49

0 Answers0