PDA

View Full Version : How to embed external program in main window.



hajh90
31st July 2019, 21:22
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::on_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();

Ginsengelf
1st August 2019, 07:14
...
WId id = QWidget::winId();
...

This does not look correct to me. I would think you need the Id of you wicdProgram, but that line gets the Id of your MainWindow.

Ginsengelf

hajh90
1st August 2019, 18:36
This does not look correct to me. I would think you need the Id of you wicdProgram, but that line gets the Id of your MainWindow.

Ginsengelf

Thank you for reply. Then how can i get the right id?

anda_skoa
1st August 2019, 19:30
Thank you for reply. Then how can i get the right id?

User shame already answered that in the other thread you posted.

Cheers,
_