Window signal and slots not working
-
I'm having a problem with the closeEvent() function override in a class which is not triggering.
This is the code I have in the main.py file:from mainwindow import * if __name__ == '__main__': app = QApplication() mainwindow = QMainWindow() window = Ui_MainWindow() window.setupUi(mainwindow) mainwindow.show() app.exec_()
And then in another file named mainwindow.py I have:
class Ui_MainWindow(QMainWindow): def setupUi(self, MainWindow): ....... def retranslateUi(self, MainWindow): ........ def closeEvent(self,event): print("Testing")
But when I close the window the closeEvent() function never runs.
I'm missing something or doing it wrong but I can't figure out what it is.
Please help. -
@pvlopez
Replied in your other topic, https://forum.qt.io/topic/143047/connect-parent-window-to-child-s-close-eventPlease don't multi-post the question, do you want people to waste their time answering in two places while others are answering too?
-
-
locked as a dublicate of
https://forum.qt.io/topic/143047/connect-parent-window-to-child-s-close-eventgive people time to answer, usually at least 24 hours.
This is a user driven forum, no-one is paid to be here :D