Dead keys can edit QTextEdit widget despite readOnly on Linux?

t_techcn t_techcn at protonmail.com
Thu Jul 7 22:23:22 BST 2022


Howdy,

I've been having a minor issue with a program since transitioning to PyQt6; On Linux, typing a character with a dead key modifier seems to let me edit the text inside a PyQt6.QtWidgets.QTextEdit widget even if I've set the text edit to read-only. Like so:

1. Highlight any part of the text.
2. With a keyboard with dead keys, press any diacritic and then a letter, like '`' + 'a' or '^' + '2'.

The character then replaces the selected part of the text.

I was able to reproduce this on Arch & Debian when using the script I've added as an attachment. PyQt5 doesn't seem to have this behavior, and it doesn't seem to occur with c++ Qt6 either as far as I can tell. Not sure how to prevent this with PyQt6.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20220707/0aad632b/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Simple_QTextEdit.py
Type: text/x-python
Size: 226 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20220707/0aad632b/attachment.py>


More information about the PyQt mailing list