I have a parent-child window in my Qt application. Parent class is a QDialog
named A and child class is QMainWindow
named B. Now I want that whenever B is closed through the 'X' button a signal is to be emitted which can be caught by a slot in class A through which I want certain functionality to be implemented. Is there a predefined signal in Qt I can use?
I want something like this:
B *b=new B;
//some code
connect(b,SIGNAL(destroyed()),this,&A::doSomething);
B also has a QWidget
which I can use to detect the destroyed signal. How do I implement this? Do I need to emit a custom signal from ~B()
?
Edit: I don't want to destroy the object b
as this would require a reallocation when I want to recreate the window B
from A
and I want to keep the parameters of b
.