Unsolved Destroy all windows
-
hi frends,
please how I can destroy all windows with puchbutton -
Hi
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
-
@ayoubBD
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) :
delete formPointer;
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:
formPointer->hide();
And if You want to have it back You can do this:
formPointer->show(); -
<joke>
QObject::connect(button,SIGNAL(clicked()),vandal,SLOT(throwBricks()));
</joke> -
connect(ui->pushButton, &QPushButton::clicked, qApp, &QApplication::closeAllWindows);