Details
-
Bug
-
Resolution: Duplicate
-
P4: Low
-
None
-
5.11
-
None
Description
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.
Attachments
Issue Links
- duplicates
-
QTBUG-55699 Japanese IME is disabled for QPlainTextEdit after read-only flag is toggled
- Closed