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 -
[quote author="darkdescendant" date="1285868796"]
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?
[/quote]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?
-
What I mean is that things like background and foreground text colors are being replaced by the highilight colors. Bold and italic are still there but those are not the only two text properties that carry information in my app.
-
I tried selecting a highlighted text in Eclipse and PSPad. It also loses its colors. Maybe it is a common behavior.
Maybe there is a performance reason - replacing a color is easier than blending with it.
Excuse that my post actually doesn't help with the problem.