Qt how to wait / find out when QMainWindow is closed?

How to find out when QMainWindow is closed? Therefore, I can update the list in another window ...

It would be great to wait until it closes.

account.h:

class account : public QMainWindow
{
//...

accounts.h

class accounts : public QMainWindow
{
//...
public:
   account accWin;
//...

accounts.cpp

//...
void accounts::on_myAction()
{
   accWin.show();
   //how do I wait/know here for accWin to be closed ? (accWin is modal)
}
+3
source share
1 answer

You can override QWidget :: closeEvent (QCloseEvent *) for your QMainWindow and update the list. closeEvent is called when your window receives a close request (i.e. while it is still visible).

Alternatively, you can connect to your QObject :: destroy (QObject *) window.

+5
source

Source: https://habr.com/ru/post/1782379/


All Articles