Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-77316

QTextEdit declares itself changed due to highlighting changes



    • Type: Bug
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.9.8
    • Fix Version/s: None
    • Component/s: GUI: Text handling
    • Labels:


      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.


        No reviews matched the request. Check your Options in the drop-down menu of this sections header.



            esabraha Eskil Abrahamsen Blomfeldt
            bhaller Ben Haller
            0 Vote for this issue
            1 Start watching this issue



                Gerrit Reviews

                There are no open Gerrit changes