qtextedit设置不可编辑

在PyQt5中,可以通过设置QTextEdit的setReadOnly属性为True来使其不可编辑。代码示例:

textedit = QTextEdit() textedit.setReadOnly(True)

这样,用户就不能在QTextEdit中进行任何编辑操作了。

  •