Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.9.8
-
None
Description
I am writing a code editor. I want to let the user turn syntax highlighting on and off in the preferences. Unfortunately, QTextEdit seems to send a textChanged message as a result of any of the following:
- adding a QSyntaxHighlighter
- removing a QSyntaxHighlighter
- a QSyntaxHighlighter performing highlighting
I don't see any way to distinguish these textChanged signals from signals that legitimately indicate that the actual text has changed. (Since my code is responsible for adding/removing a highlighter, I can set a flag for myself to ignore the change message that I know I will receive across those operations; but I see no way to do that for the third case, especially since rehighlight is a non-virtual method. It would be useful for that to be virtual, to allow more flexible subclassing.)
It seems to me that syntax highlighting should never result in a textChanged signal; the text has not changed. For clients who want to know even when syntax highlighting has changed, I would suggest adding a new signal.
The end result of this bug is that my document state dirties unnecessarily, and I don't see a way to prevent that from happening. Not the end of the world, but not ideal.