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

QPlaintTextEdit's 'setReadOnly' seems to be malfunctioning



    • Type: Bug
    • Status: Reported
    • Priority: P4: Low
    • Resolution: Unresolved
    • Affects Version/s: 5.11
    • Fix Version/s: None
    • Component/s: GUI: Text handling
    • Labels:
    • Platform/s:


      Forgive me, for the sake of work, let this bug exist silently for 2 years. And I found this problem since I started using qt4.8.5 until qt5.11. I am not sure if there is still a problem with the new version today, because I have not used the updated version yet.

      This question is about 'readonly' and 'inputmethod' control. 

      Expressed as, I call 'setReadOnly(true)' and then call 'setReadOnly(false)', QPlainTextEdit will no longer be able to use the input method (but it works at first). So I looked at the source code and compared it with QTextEdit, which has similar functionality but no such problem.

      I found them in the same place, the source code order is the opposite.

      This is the code snippet in QPlaintTextEdit's setReadOnly method:

      And this is how QTextEdit's looks like: 

      They all control text interaction and input methods.

      When we want to set read-only to be true, QTextEdit first closes the text interaction permission, after that isReadOnly is true, then he calls 'shouldEnableInputMethod' to control the input method permission, the function will reverse the return value of isReadOnly.It means call 'shouldEnableInputMethod' will return false. But in QPlainTextEdit, it calls 'shouldEnableInputMethod' first, which get true as a return value, so in fact it does not close the input method.

      When we want to set read-only to be false. QTextEdit still works well, turns on text interaction, and get true from 'shouldEnableInputMethod', then set input method to be true. But QPaintTextEdit, It can no longer work properly, it get false from 'shouldEnableInputMethod' and set input method to be false, then turns on text interaction. 

      The result is that once we have set operation on setReadOnly, it can no longer support the input method.


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



            esabraha Eskil Abrahamsen Blomfeldt
            leegjc 根俊超 李
            0 Vote for this issue
            1 Start watching this issue



                Gerrit Reviews

                There are no open Gerrit changes