setting line to read-only

泄露秘密 提交于 2019-12-11 05:53:52

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!