I have the main and mainwindows cpp, yes, i need to have both.
How do i do to main.cpp performing a action only after mainwindow.cpp is closed?

I have tried
ConfigCamera c;
c.show();
c.CameraQuantidade(CAMERAS);
c.close();
std::cout <<"i'm here" <<std::endl;

and
ConfigCamera c;
c.show();
c.CameraQuantidade(CAMERAS);
while(!c.isClosed) {
}
std::cout <<"i'm here" <<std::endl;

but they haven't work.

How should i do this?