I am experiencing a rather strange issue with my PyQT QTextEdit.
When I enter a string from my QLineEdit it adds it but say I enter another the first string disappears I assume that's because I am not appending the text.
Any idea how I can do this?
Here is the relevant code:
self.mytext.setText(str(self.user) + ": " + str(self.line.text()) + "
")
and the important one
self.mySignal.emit(self.decrypt_my_message(str(msg)).strip() + "
")
Edit
I figured it out I needed to use a QTextCursor
self.cursor = QTextCursor(self.mytext.document())
self.cursor.insertText(str(self.user) + ": " + str(self.line.text()) + "
")
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…