#include "mainwindow.h"
#include <QApplication>
#include <QtWebKit>
#include <QWebView>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QWebView *view = new QWebView();
QWebSettings::PluginsEnabled;
view->load(QUrl("http://www.paulirish.com/demo/multi"));
view->show();
return a.exec();
}
I am trying to load a plugin in QtWebkit Webview but it isnt being loaded. I couldnt find the right path as mentioned Here, but it isnt loading. I have added Env. Variable QTWEBKIT_PLUGIN_PATH to System Variable & MOZ_PLUGIN_PATH was already in user variable, added by Foxit Reader. I tried placing the plugin dll file on both the directories corresponding to the Env. Variables but it isnt loading the plugin. After i palced the plugin in Moz_plugin_path, firefox was able to detect the plugin.
我试着在QtWebkit Webview加载一个插件,但是它没有被加载。我找不到这里提到的正确路径,但它没有加载。我有添加Env。变量QTWEBKIT_PLUGIN_PATH到系统变量& MOZ_PLUGIN_PATH已经在用户变量中,由Foxit阅读器添加。我尝试将插件dll文件放在与Env对应的目录上。变量,但它没有加载插件。在我在Moz_plugin_path中安装了这个插件之后,firefox就能够检测到这个插件了。
As for enabling the plugin in QTWebview i have tried using
至于在QTWebview中启用插件,我已经尝试过了。
QWebSettings::PluginsEnabled;
QWebSettings:PluginsEnabled;
QWebSettings::globalSettings()->setAttribute(QWebSettings::PluginsEnabled,true);
QWebSettings:globalSettings()- > setAttribute(QWebSettings::PluginsEnabled,真的);
view->page()->settings()->PluginsEnabled;
视图- >页()()- >设置- > PluginsEnabled;
but found success with none of them, I am using Windows 8.1 and Qt 5.2
但是,我发现他们都没有成功,我使用的是Windows 8.1和qt5.2。
2 个解决方案
#1
1
You should set the QWebSettings::PluginsEnabled
attribute. The way you are doing it, nothing is happening.
您应该设置QWebSettings::PluginsEnabled属性。你这样做的方式,什么都没有发生。
Enable the attribute with the following code:
使用以下代码启用该属性:
QWebSettings::globalSettings()->setAttribute(QWebSettings::PluginsEnabled, true);
Put this before your QWebView
creation.
把这个放在你的QWebView创建之前。
Refer to the documentation for more details:
更多细节请参考文档:
QWebSettings文档
#2
0
i have been through exactly the same situation. what solved my problem was to install adobe flash player plugin for NPAPI. Modern web browsers like Google Chrome and Firefox are often distributed with builtin flash player plugin. So Chrome/Firefox works well does not ensure that you have the proper flash plugin installed properly systemwide, which is needed by Qt5WebKit to enable local plugin support for Flash content.
我也经历过同样的情况。解决我的问题的是为NPAPI安装adobeflashplayer插件。像谷歌Chrome和Firefox这样的现代web浏览器通常都是内置的flash player插件。所以,Chrome/火狐很好用,它不能确保你的flash插件安装得很好,这是Qt5WebKit所需要的,它可以让本地插件支持flash内容。
so, make sure the adobe flash player plugin for NPAPI is installed, and hope it would solve your problem.
因此,确保安装了NPAPI的adobe flash player插件,希望它能解决您的问题。
#1
1
You should set the QWebSettings::PluginsEnabled
attribute. The way you are doing it, nothing is happening.
您应该设置QWebSettings::PluginsEnabled属性。你这样做的方式,什么都没有发生。
Enable the attribute with the following code:
使用以下代码启用该属性:
QWebSettings::globalSettings()->setAttribute(QWebSettings::PluginsEnabled, true);
Put this before your QWebView
creation.
把这个放在你的QWebView创建之前。
Refer to the documentation for more details:
更多细节请参考文档:
QWebSettings文档
#2
0
i have been through exactly the same situation. what solved my problem was to install adobe flash player plugin for NPAPI. Modern web browsers like Google Chrome and Firefox are often distributed with builtin flash player plugin. So Chrome/Firefox works well does not ensure that you have the proper flash plugin installed properly systemwide, which is needed by Qt5WebKit to enable local plugin support for Flash content.
我也经历过同样的情况。解决我的问题的是为NPAPI安装adobeflashplayer插件。像谷歌Chrome和Firefox这样的现代web浏览器通常都是内置的flash player插件。所以,Chrome/火狐很好用,它不能确保你的flash插件安装得很好,这是Qt5WebKit所需要的,它可以让本地插件支持flash内容。
so, make sure the adobe flash player plugin for NPAPI is installed, and hope it would solve your problem.
因此,确保安装了NPAPI的adobe flash player插件,希望它能解决您的问题。