closeEvent doesn't seem to fire properly
See original GitHub issueusage:
def main():
app = QApplication(sys.argv)
main_window = RemingtonUI()
styles.dark(app)
styled_window = windows.ModernWindow(main_window)
styled_window.show()
sys.exit(app.exec_())
if __name__ == '__main__':
main()
RemingtonUI usage:
class RemingtonUI(QMainWindow):
def __init__(self):
super(QMainWindow,self).__init__()
# other setup here
self.ui = uic.loadUi('remington/resources/mainwindow.ui')
self.setCentralWidget(self.ui)
The closeEvent call doesn’t happen after clicking the red close button once windows.ModernWindows(main_window) is called. It doesn’t happen if I set self.ui.closeEvent = self.closeEvent either.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
closeEvent not working - Qt Forum
I have the following code but closeEvent is never reached. I need to intercept when someone close the window and I would like...
Read more >Node.js server 'close' event doesn't appear to fire
The server doesn't seem to fire any kind of close / finish / terminate event despite what is claimed in the doc. The...
Read more >225654 - EventSource close event doesn't fire when computer ...
Issue 225654: EventSource close event doesn't fire when computer put into sleep mode ... It's a hell to make it work properly.
Read more >Closing Window with Hide option does not fire the After Close Event ...
When I specify "Close Mode" "Hide" it fires only the first time when you close the window. If you specify "Destroy" it works...
Read more >Thread: Calling destructors on close event - Qt Centre Forum
If you still receive marks, then either the lastWindowClosed() signal doesn't fire or some window remains open. 27th November 2007, 17:36 ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Hi,
One solution would be to subclass
ModernWindowand link there all the slots from the enclosed window. I have implemented the close event link onModernWindow.Ok, I dug around, and I found where the problem is.
class ModernWindow(QWidget)is subclassingQWidgetand thus taking thecloseEventmethod.I added
closeEvent()toModernWindowand the closeEvent responded correctly with “It worked”