I have 2 QTextEdit widgets and I need to put whatever is entered in the first to the second on a press of the enter key (Return)…. I am not able to implement it please help?
I know I need to use KeyPressEvent but I don’t understand how to use it only for the QTextEdit??
self.textEdit = QtGui.QTextEdit(self.widget)
self.textEdit.setMinimumSize(QtCore.QSize(201, 291))
self.textEdit.setMaximumSize(QtCore.QSize(201, 291))
self.textEdit.setObjectName("textEdit")
self.textEdit.setReadOnly(True)
self.verticalLayout.addWidget(self.textEdit)
self.textEdit_2 = QtGui.QTextEdit(self.widget)
self.textEdit_2.setMinimumSize(QtCore.QSize(201, 41))
self.textEdit_2.setMaximumSize(QtCore.QSize(201, 41))
self.textEdit_2.setObjectName("textEdit_2")
self.textEdit_2.setFocusPolicy(Qt.StrongFocus)
self.verticalLayout.addWidget(self.textEdit_2)
Any help is appreciated I am stuck…..
Here is a small example that shows
QLineEditand itsreturnPressedsignal. Upon pressing return the text in theQLineEditwill be appended to theQTextEdit: