问题
Ive been looking though the QsciScintilla API, and I want to know how to set a line in a text editor to read -only. I know it provides a setReadOnly function. But this sets the whole text editor to read-only.
Any suggestions on how to set a line to read-only?
Im using PQT4 Python 3x
回答1:
You can't really do this. There is a low-level feature in the underlying Scintilla control that can prevent the caret moving into an area of text - but it cannot prevent deletion of a broader area of text that contains a "read-only" part. But even if this was sufficient for your purposes, this feature can only be applied to ranges of styled text, not specific lines.
If you just want to associate some read-only text with a specific line, you could use an annotation.
来源:https://stackoverflow.com/questions/22428152/setting-line-to-read-only