Run an external application inside a qwidget

2019-03-04 16:15发布

How can we embed an external application inside a QWidget?

I have tried same using QX11EmbedContainer but getting error "XEvent has not been declared".

I have tried below mentioned code ('this' represents a qwidget class reference )

     QX11EmbedContainer * container = new QX11EmbedContainer(this);
     container->show();

     QProcess * process = new QProcess(container);
     QString executable("\"C:\\Program Files\\Windows Media Player\\wmplayer.exe\"");

     process->start(executable);

     this->show();

container object i am trying to add to current tab of tabwidget object in which i want to run some external application(Application1). This is my code

     QTabWidget *tabWidget = new QTabWidget;

     /* Trying to add external appllication to a tab of tabwidget object */
     QX11EmbedContainer * container = new QX11EmbedContainer(tabWidget->currentWidget());
     container->show();

     QProcess * process = new QProcess(container);
     QString executable("/home/abhishek/practice/Applicaion1");

     process->start(executable);

Application1 gets executed but in a seperate window but i want it to run in my tab

标签: qt qt4
1条回答
Emotional °昔
2楼-- · 2019-03-04 16:49

QX11EmbedContainer only works on X11 (e.g., on Linux). From the looks of it, you're trying to do this on Windows.

I'm not very familiar with using Qt on Windows, but it looks like the equivalent functionality is provided by the ActiveQt module. You might be able to accomplish something like this within that framework.

查看更多
登录 后发表回答