Ruud v A
16th May 2010, 17:21
Hello everyone,
I am writing a syntax highlighter with QPlainTextEdit, QSyntaxHighlighter and QTextDocument. I want to set the background colour of the editor. I successfully managed to set the background colour of the QPlainTextEdit, and I can set the background colour of individual text blocks with syntax highlighting. However, QTextDocument seems to render a little margin around the text. It renders a white border around the document. Also setting the background colour explicitly every time when highlighting seems unnecessary, it would be better to set the background colour of the entire document. I have tried to use setDefaultStyleSheet but that doesn't work. So how do I set the background colour of a QTextDocument?
Qt 4.6, Windows at the moment but should also apply to other platforms
Thanks in advance,
Ruud
I am writing a syntax highlighter with QPlainTextEdit, QSyntaxHighlighter and QTextDocument. I want to set the background colour of the editor. I successfully managed to set the background colour of the QPlainTextEdit, and I can set the background colour of individual text blocks with syntax highlighting. However, QTextDocument seems to render a little margin around the text. It renders a white border around the document. Also setting the background colour explicitly every time when highlighting seems unnecessary, it would be better to set the background colour of the entire document. I have tried to use setDefaultStyleSheet but that doesn't work. So how do I set the background colour of a QTextDocument?
Qt 4.6, Windows at the moment but should also apply to other platforms
Thanks in advance,
Ruud