PDA

View Full Version : How to run an .exe of a Qt application in tabwidget



shivendra46d
11th February 2015, 06:10
Hello
I want to launch a qt application inside my table widget.
I tried the following code:


QX11EmbedContainer * container = new QX11EmbedContainer(ui->tabWidget->currentWidget());

container->show();

QString executable("/home/wbtdev/Desktop/SP4_Release/ActionSequencer");
QProcess * process = new QProcess(container);

process->start(executable);

But the problem that I am facing is that the application launches the exe. as separate application. I want that the application should be launched inside the tab widget.
Any help ?

jefftee
11th February 2015, 07:48
I want that the application should be launched inside the tab widget.
You have a misunderstanding of QProcess. It creates a separate process for the program you run, so by definition it creates a separate process.

What I suspect you mean is that you want the output of that process to be shown inside your application.

To do that is easy, just connect the QProcess signals to slots in your program so that you can be notified when the process starts, stops, changes state, has output ready to read, etc.

You can then write status messages to your window and if you want to display the actual stdout or stderr messages the process outputs, then you will use QProcess::readyReadStandardOutput() and QProcess::readyReadStandardError(), etc.

Hope that helps.

shivendra46d
11th February 2015, 18:44
You have a misunderstanding of QProcess. It creates a separate process for the program you run, so by definition it creates a separate process.

What I suspect you mean is that you want the output of that process to be shown inside your application.

To do that is easy, just connect the QProcess signals to slots in your program so that you can be notified when the process starts, stops, changes state, has output ready to read, etc.

You can then write status messages to your window and if you want to display the actual stdout or stderr messages the process outputs, then you will use QProcess::readyReadStandardOutput() and QProcess::readyReadStandardError(), etc.

Hope that helps.

I am sorry sir but still i can not get the desired results

jefftee
12th February 2015, 06:42
I am sorry sir but still i can not get the desired results
What did you try and what was the result? Post a minimal example using the
tags that demonstrates what you tried, etc.