Following is my definition of confirm window( the window that is opened on clicking submit button in main window). confirmwindow.h
#ifndef CONFIRMWINDOW_H
#define CONFIRMWINDOW_H
#include <QDialog>
namespace Ui {
class ConfirmWindow;
}
class ConfirmWindow : public QDialog
{
    Q_OBJECT
public:
    explicit ConfirmWindow(QWidget *parent = 0);
    ConfirmWindow(QString name);
    ~ConfirmWindow();
private:
    Ui::ConfirmWindow *ui;
};
#endif // CONFIRMWINDOW_H
And in confirmwindow.cpp I defined in following manner
#include "confirmwindow.h"
#include "ui_confirmwindow.h"
ConfirmWindow::ConfirmWindow(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::ConfirmWindow)
{
    ui->setupUi(this);
}
ConfirmWindow::~ConfirmWindow()
{
    delete ui;
}
ConfirmWindow::ConfirmWindow(QString name)
{
    ui->label_show_name->setText(name);
}
when I run the program it all goes well untill I press submit button, which crashes the app with a message in console as The program has unexpectedly finished.
In mainwindow.cpp I've called it as
void MainWindow::on_pushButton_submit_clicked()
{
    ConfirmWindow confirm_window(ui->lineEdit_name->text());
    confirm_window.exec();
}
I guess, I am defining the constructor in a wrong way in confirmwindow.cpp file.
 
    