How can I connect to a function on close of QTextEdit widget Window?
My Code:
self.textBox = QtGui.QTextEdit()
self.textBox.setWindowTitle('Editor')
self.textBox.setGeometry(100, 100, 1000, 500)
self.textBox.show()
self.textBox.???.connect(self.someFunc) #????
If I do
self.textBox.close().connect(self.someFunc)
It closes immediately and says
AttributeError: 'bool' object has no attribute 'connect'
If I do
self.textBox.closeEvent(self.someFunc)
It says
TypeError: QTextEdit.closeEvent(self.someFunc): argument 1 has unexpected type 'method'
How can I solve this?
It is not the most elegant way but it works, the other way is to inherit from QTextEdit and overwrite the closeEvent method by issuing a signal.
Use: