These are the widgets that I have,
self.recipient = QTextEdit(self)
self.document = QTextDocument(self)
self.recipient.setDocument(self.document)
self.cursor = QTextCursor(self.document)
and what I want to do is use the QTextCursor
to copy the selected text in my QTextEdit
. I have tried the function selectedText()
, but it gives me an empty string. Here is how I try to print it:
print('%s' % (self.cursor.selectedText()))