question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

closeEvent doesn't seem to fire properly

See original GitHub issue

usage:

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:closed
  • Created 6 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
gmarullcommented, Oct 12, 2017

Hi,

One solution would be to subclass ModernWindow and link there all the slots from the enclosed window. I have implemented the close event link on ModernWindow.

0reactions
tisaconundrum2commented, Oct 11, 2017

Ok, I dug around, and I found where the problem is. class ModernWindow(QWidget) is subclassing QWidget and thus taking the closeEvent method.

I added closeEvent() to ModernWindow and the closeEvent responded correctly with “It worked”

image

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found