You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Tuesday, November 22nd 2011, 5:24pm

How do I know when a QMainWindow is closed?

How can I trigger a function to be called when a QMainWindow is closed? I have a very long loop that I want to abort when the user closes the window. I want that when that happens, a function is called that will set a flag to true, which in turn will tell the loop to finish.

2

Tuesday, November 22nd 2011, 6:07pm

I solved it, after googling for a while I realized that I could do that by overloading the closeEvent function that exists in the class that is derived from QMainWindow by Qt Creator when the project is created.