Destroy all windows
please how I can destroy all windows with puchbutton
How do you create them?
Normally, you can just use the variable to delete them again.
There is also close() to close them but it all depends on what you are doing :)
@mrjj I create them with QT disigner
ok, but how do you open/show then?
just put the variables as member in .h
and keep them around after you new the forms.
i assume you do something like
MyForm * form=new MyForm(this) ?
If the Form pointer is named for example "formPointer" just delete it in the on_Pushbutton function(slot in header file) :
formPointer = nullptr;
Then Form will disappear. So You can not have it back, but if You want just to hide it and show it again on some action.
You can do this:
And if You want to have it back You can do this:
connect(ui->pushButton, &QPushButton::clicked, qApp, &QApplication::closeAllWindows);