1

Ok so I hooked up the QTextEdit with spdlog. But how to get the colorized output from spdlog/fmt to show in the QTextEdit? Am I doomed to implement my own message handler for that to happen? Or is there a slicker way?

anlowho
  • 11
  • 1

1 Answers1

0

I saw the Qt Creator output pane can handle ASCII color codes. So I pulled this code from its source code and added extra functionality(bold, italic etc). After that I take QTextCursor* from QTextEdit or QPlainTextEdit objects and easily parse color codes and insert into thise widgets. In order to use this functionality you have to change spdlog's qt_sinks.h header with this.. After that use this helper class to see colored output in these widgets.

Example result: enter image description here

M. Galib Uludag
  • 369
  • 2
  • 8