开发者

Qt, QPlainTextEdit and non-printable characters

开发者 https://www.devze.com 2023-02-15 04:38 出处:网络
I wonder if there is any possibility to render special characters (0-31 ASCII, for example) my own way in Qt/QPlainTextEdit? I want to render them as small rectangles as seen in this screenshot:...or

I wonder if there is any possibility to render special characters (0-31 ASCII, for example) my own way in Qt/QPlainTextEdit? I want to render them as small rectangles as seen in this screenshot:

Qt, QPlainTextEdit and non-printable characters

...or as Notepad++ is doing it. My goal is to be able see all characters.开发者_Go百科 So if a character fails to render with current font (there is no such char for example), a small square should be rendered instead.


Qt does have ways to represent non-characters in QTextDocument which is used in QTextEdit and QPlainTextEditor. There's a sample on inserting an SVG object into a text edit: http://doc.qt.io/archives/qt-4.7/richtext-textobject.html

Or you can use your own QAbstractTextDocumentLayout to handle the drawing of various text objects in the QTextDocument.

0

精彩评论

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