在qwidget中运行外部应用程序 [英] Run an external application inside a qwidget

查看:19
本文介绍了在qwidget中运行外部应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将外部应用程序嵌入QWidget?

我已尝试使用QX11EmbedContainer进行相同操作,但收到错误"XEvent尚未声明"。

我尝试了下面提到的代码(‘This’表示一个qwidget类引用)

     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();
我正尝试将容器对象添加到Tab小部件对象的当前选项卡中,我希望在其中运行一些外部应用程序(应用程序1)。 这是我的代码

     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);

应用程序1在单独的窗口中执行,但我希望它在我的选项卡中运行

推荐答案

QX11EmbedContainer只支持X11(如linux)。从外观上看,您正在尝试在Windows上执行此操作。

我不太熟悉在Windows上使用Qt,但看起来ActiveQt模块提供了相同的功能。您或许能够在该框架内完成类似的工作。

这篇关于在qwidget中运行外部应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆