Search code examples
pythonpyqtpyqt4

How to make Qtextedit text and non-selectable?


Is there a PyQt QTextEdit method that disables selecting/highlighting of and/or right-clicking on displayed text? Or at least disables clipboard functions such as copy? Thanks.

To clarify none-duplicity of this question, I'm talking about this. I want none of that highlight thing when trying to click and drag across part of the displayed text.


Solution

  • Try with this

    #QTextEdit.setTextInteractionFlags (self, Qt.TextInteractionFlags flags)
    #QTextEdit.setText (self, QString text)
    
    textEdit.setTextInteractionFlags (QtCore.Qt.NoTextInteraction)    
    textEdit.setText ('How to make Qtextedit text and non-selectable?')