I have some python code that generates some information that I want to be able to print or display in a window.
The whole window will be used to display the text with rich format (bold, italics, colored fonts, various font sizes, etc.). The text should also be read only. Also the cursor should not be visible. Just like in a web-browser.
Which PyQt class should I use for this? If this can be done using QTextEdit
, please let me know how to make it read only and apply the various kinds of formatting to the text.If any other PyQt class is more suitable for this, please let me know.
UPDATE: I found this class: http://pyqt.sourceforge.net/Docs/PyQt4/qtextdocument.html It says
QTextDocument is a container for structured rich text documents, providing support for styled text and various types of document elements, such as lists, tables, frames, and images. They can be created for use in a QTextEdit, or used independently.
Is there an advantage of using QTextDocument
class instead of the QTextEdit
directly?
QTextEdit
can be set to read-only. Did you know that?You've gone to great lengths to say this isn't good enough for your application, but you haven't said what is wrong with usingQTextEdit
. Without more details on whyQTextEdit
is bad (even in read-only mode) I can't suggest anything else.