Windows下flash插件路径在C:\WINDOWS\system32\Macromed\Flash\NPSWF32.dll,利用这插件可以实现播放内嵌页面里的flash,需要将此dll拷贝到QtSDK的插件目录下(如D:\Workshop\QtSDK\Desktop\Qt\4.7.4\mingw\plugins)。
main.cpp
- #include <QApplication>
-
#include <QWebView>
-
-
int main(int argc, char *argv[])
-
{
-
QApplication app(argc, argv);
-
-
QWebSettings *settings = QWebSettings::globalSettings();
-
settings->setAttribute(QWebSettings::PluginsEnabled, true);
-
settings->setAttribute(QWebSettings::JavascriptEnabled, true);
-
-
QWebView *webView = new QWebView;
-
webView->load(QUrl(""));
-
webView->show();
-
-
return app.exec();
-
}
qtFlashPlugin.pro
- QT += webkit network
-
TARGET = qtFlashPlugin
-
TEMPLATE = app
-
SOURCES += main.cpp
在QtCreator中编译运行
阅读(11395) | 评论(3) | 转发(0) |