[Solved]Restart a dialog
-
Hi everyone,
I want to restart a dialog (reopen). The dialog is attached to a mainwindow as modal application. Some Ideas?
Thanks@#include "dialog.h"
#include "ui_dialog.h"Dialog::Dialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::Dialog)
{
ui->setupUi(this);
}Dialog::~Dialog()
{
delete ui;
}void Dialog::on_Restart_button_clicked()
{
//close and restart the QDialog, this Dialog is attached to another mainwindow
}@ -
One of the possible ways:
Create a slot in MainWindow, let say restartDialog()
Connect it with a restartDialog() signal from the Dialog.
In a closeEvent() of the Dialog emit a signal to restart a dialog. -
Another possible solution:
If Dialog is modal dialog then you can use return code from
"int QDialog::exec()":http://qt-project.org/doc/qt-5/qdialog.html#exec and and restart if return code is not one of "QDialog::DialogCode":http://qt-project.org/doc/qt-5/qdialog.html#DialogCode-enum -
Hey,
thanks andreyc I made it with closeEvent()!!!