Text selections is causing custom formatting to be overwritten
I am using a QTextEdit widget with a QSyntaxHighligher attached to do syntax highlighting. This is a great solution but I have run into an issue I can’t seem to find any info on.
It appears that text selection/highlighting in QTextEdit causes the formatting for the selected text to be replaced with the selection foreground and background colors. As soon as you remove the selection the formatting returns but while selected all my formatting is gone.
Is there any way to make selection highlighting to respect the current format? Somehow change the highlighting format specifically so it blends with the text formatting and not replaces it?
Thanx,
joe
4 replies
Is there any way to make selection highlighting to respect the current format? Somehow change the highlighting format specifically so it blends with the text formatting and not replaces it?
When you say current format, are you talking about italics and bold? Even if you use the QSyntaxHighlighter they are still retained. You can see the richtext/syntax highlighter demo that ships with Qt …
or are you talking about some other format?
You must log in to post a reply. Not a member yet? Register here!


