I'm using Python3 and PyQt5 to create an application containing form elements such as QLineEdit and QTextEdit.
I collect data from a QLineEdit as follows (this is working properly):
self.rolAdi = QtWidgets.QLineEdit(self.centralWidget)
self.rolAdi.setObjectName("rolAdi")
self.rolAdi.textChanged.connect(self.textSonDurum)
def textSonDurum(self, s):
print("Text changed...>>> "+s)
However, the same method using a QTextEdit control doesn't work - the program stops whenever I change the content of the control:
self.IP = QtWidgets.QTextEdit(self.centralWidget)
self.IP.setObjectName("IP")
self.IP.textChanged.connect(self.textSonDurum)
def textSonDurum(self, s):
print("Text changed...>>> "+s)
I researched about this problem and I found a suggestion involving using the disconnect function, but cannot find it in PyQt5.
self.IP.textChanged.disconnect()
Output Error:
TypeError: disconnect() failed between 'textChanged' and all its connections
(The full code is very long to paste it here but let me know if you need any other part).