I am using qt creator and i want to embed the external program in main window. I created the codes but if i click push button for external program, then the ui is closed and it says "External WM_DESTROY received for QWidgetWindow(0x1fd65538, name="MainWindowWindow") , parent: QWindow(0x0) , transient parent: QWindow(0x0)". Can anyone help me to figure it out?

This is my code.

void MainWindow:n_pushButton_8_clicked()
{
QString program = "D:\\my program name.exe";
QProcess *wicdProgram;
wicdProgram = new QProcess(this);
wicdProgram->setProgram(program);
WId id = QWidget::winId();
QWindow *window = QWindow::fromWinId(id);
window->setFlags(Qt::FramelessWindowHint);
window->show();
QWidget *widget = QWidget::createWindowContainer(window)

widget->show();

setCentralWidget(widget);

ui->gridLayout->addWidget(widget);
wicdProgram->start();