How to have unselectable portion of text in QTextEdit/QTextDocument?
Suppose I have text like this in QTextEdit:
This is sample text
The word "sample" should be treated as if it was 1 single character, i.e. when I try to select it either all the characters in the word should be selected or none. Same when I navigate the document with left/right keys, the cursor should believe that the whole word is one single atomic item, i.e. if the cursor is at the end of the word, pressing left should jump to the beginning of the word and vice versa. Backspace should delete the whole item.
The best thing I could think of is to generate an image with that word on the fly and insert it in the right position, but this feels very hacky, I wonder if there is a better way of doing this?