QLineEdit can contain only plain text and certainly can't do this. I was thinking about QTextEdit, it can display HTML. But looking at the documentation, I realized that there is no way to insert non-editable block in QTextDocument (which is used by QTextEdit). I think there is no simple solution.
You can try to implement it manually. Catch textChanged()
and cursorPositionChanged()
signals of QTextEdit
, analyze its content and cursor position and modify them if user moved the cursor into non-editable block or changed its content.