在Linux上通过插件将Qt窗口嵌入到Firefox中 [英] Embed Qt window into firefox, via plugin, on Linux

查看:1306
本文介绍了在Linux上通过插件将Qt窗口嵌入到Firefox中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,这是我试图完成的一个简单的例子:

使用QX11EmbedContainer和QX11EmbedWidget,我可以创建两个独立的应用程序,一个进入另一个的窗口(容器< - 小部件)。所以我创建了一个基本的插件,它只包含了QX11EmbedContainer(从微不足道开始) 'qtbrowserplugin的例子),仅用于测试目的,另一个通用的小部件。



结果是通用小部件在插件内部显示得很好,但是容器小部件'弹出'到一个单独的窗口。

这发生在Firefox,Chrome甚至是Konqueror下。

所以问题是 - 是否可以将外部Qt小部件嵌入到插件中?

解决方案

答案是肯定的,但是Qt代码是bug,这就是为什么我不包含它 - 不管怎么样托管(在Trolltech工程师的帮助下)插入一个香草QTextEdit小部件。在尝试输入文本时,插件会崩溃,经常带着Firefox。很明显,将Qt对象直接嵌入到插件中是一个不行的方法。



我也试着单独使用 mozplugger ,但这是它自己的问题 - 主要是焦点没有正确的跟踪,往往会丢失,要求你重新启动插件得到它。 >

So this is a trivial example of what I'm trying to accomplish:

Using QX11EmbedContainer, and QX11EmbedWidget, I can create two separate apps that embed the widget from one into the window of the other (container <- widget). I would like to do the same in Firefox, and embed the widget into a plugin.

So I created a basic plugin that just contains the QX11EmbedContainer (starting from the 'trivial' example of qtbrowserplugin), and just for testing purposes, another generic widget.

The result is that the generic widget shows inside the plugin just fine, but the container widget 'pops' out to a separate window.

This occurs under Firefox, Chrome, and even Konqueror.

So the question is - Is it possible to embed external Qt widgets into a plugin?

解决方案

The answer is yes, but the Qt code is buggy, which is why I'm not including it- you wouldn't want it anyway. Managed (with the help of Trolltech engineers) to insert a vanilla QTextEdit widget. Upon attempting to enter text, the plugin would crash, often taking Firefox with it. So clearly, embedding Qt objects directly into a plugin is a no-go.

I also tried launching it separately with mozplugger, but that had it's own issues - mainly focus was not tracked correctly, and would often be lost, requiring you to restart the plugin to get it back.

这篇关于在Linux上通过插件将Qt窗口嵌入到Firefox中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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