开发者

Qt and command console text color

开发者 https://www.devze.com 2023-02-07 12:18 出处:网络
I\'d like to write some text to the console where the text has a background color of blue (the highlighting is blue) and the text has a foreground color of white (the text is white) and the text is bo

I'd like to write some text to the console where the text has a background color of blue (the highlighting is blue) and the text has a foreground color of white (the text is white) and the text is bold.

To be clear, I'd like to do this the "Qt way" if this is possible with Qt.

I have not seen a way to this with Qt.

I realize the WinAPI has such powers... but I'd rather use Qt for this... if possible... because I'd like this to work on Linux, Windows, and MAC.

I'm usi开发者_开发百科ng C++.


I don't know Qt has any thing other than basic text IO for console. After all, Qt is aim at GUI development.

The closest think I can think of is ANSI escape code. It's supported in most U*ix systems terminals. Unfortunately, Windows command line window doesn't seem to support it at all. You may have to use platform specific code for Windows while using ANSI escape sequence on other OS.

This brings back the memory of ANSI.SYS in the DOS days. Ah...

0

精彩评论

暂无评论...
验证码 换一张
取 消