#pyqt | Logs for 2019-03-07
Back
[02:21:05] -!- ntome has joined #pyqt
[03:15:25] -!- kushal has quit [Remote host closed the connection]
[03:15:40] -!- kushal has joined #pyqt
[05:17:28] -!- Avaris_ has joined #pyqt
[05:19:49] -!- Avaris_ has quit [Client Quit]
[09:43:20] -!- Siecje has joined #pyqt
[09:44:21] -!- nsizemor has joined #pyqt
[09:49:35] <nsizemor> I've an application where if a user clicks a button, it opens a new window containing some more detailed information. Currently, that window is just created on the fly in the main app, i.e. "self.subwindow = QWidget()", and then populated with various widgets. Is there a way I can detect when the user closes this window so I can clean up after myself, without having to refactor, make subwindow a new class, and implementing closeEvent()?
[09:50:52] <Avaris> nsizemor: installEventFilter is one way
[09:51:07] <Avaris> (to catch closeEvent)
[09:53:35] <nsizemor> Avaris: Ah, that's a good idea. I should probably go back at some point and do the refactor, but I think an event filter will get me there for now. Thanks!
[09:57:36] <Avaris> nsizemor: fyi there is alse Qt::WA_DeleteOnClose
[09:57:54] <Avaris> https://doc.qt.io
[09:58:03] <Avaris> *also
[10:01:24] <Avaris> that would prompt a `destroyed` signal. just make sure you don't do anything with reference after closing. could be good way to crash :)
[10:03:04] <nsizemor> Avaris: Hmm . . . that's an interesting idea, as well.
[10:32:44] -!- AbleBacon has joined #pyqt
[10:38:51] <nsizemor> Avaris: adding the event filter got me where I needed to go. Long term, I'll probably refactor, but for now, my problem is solved. Thanks again!