问题描述
Qt GUI应用程序如何在不同的进程中启动单独的GUI应用程序并管理其窗口?
How would a Qt GUI application start separate GUI applications in different processes and managed their windows?
假设我有一个名为myApp的Qt应用程序.用户可以从myApp内部启动OS上可用的外部应用程序,这些应用程序可以以自己的独立进程运行.我了解QProcess,但是我无法弄清的困难部分是管理窗口.myApp将需要拥有自己的Windows标题栏,并且必须跨平台.如果我启动一个应用程序,请说Windows上的计算器,如何摆脱OS默认设置的OS标题栏和窗口框架,然后如何管理该窗口的位置和几何形状?
Let's say I have a Qt application call myApp. The user is able to launch external application available on the OS from within myApp that run in their own separate process. I know about QProcess, but the difficult part that I haven't been able to figure out is managing the windows. myApp will need to have it's own title bars for windows and also be cross platform. If I launch an application, say the calculator on Windows, how do I get rid of the OS title bar and window frame with OS default one, and then how do I manage the position and geometry of that window?
更多详细信息:想法是能够通过添加以任何语言和任何GUI工具箱实现的新服务来扩展myApp(包括第三方).另外,如果服务崩溃,则不应影响myApp或其他服务.为了进行类比,假设在Visual Studio中,是否在C中实现了编辑器,在GTK中实现了GUI,在C ++中实现了调试器,并在Qt中实现了接口,等等,那么一切看起来都是一样的.
more details:The idea is to be able to extend myApp, including by 3rd parties, by adding new services that are implemented in any language and any GUI toolkit. Also, if a service crashes, it shouldn't affect myApp or other services. To use an analogy, imagine if in Visual Studio the editor was implemented in C and its GUI in GTK, the debuger in C++ and its interface in Qt, etc, and everything looked one piece.
推荐答案
从我从您的问题中得到的任何信息以及从我所知的Qt中,Qt不支持处理其他应用程序(例如更改位置).因此,您将不得不不同地处理不同平台上的应用程序.也就是说,如果您的myApp在Windows中并且您运行计算器程序.然后,您可以使用winApis处理计算器应用程序,就像可以使用SetWindowPos设置其pos等.
From whatever I got from you question and from whatever Qt I know, Qt does not support to handle other application(like changing position). So you will have to handle applications on different platform differently. i.e. if your myApp is in windows and you run calculator program. Then you can use winApis to handle the calculator app like you can use SetWindowPos to set its pos, etc.
这篇关于如何在Qt应用程序中管理单独的GUI进程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!