QWebView加载网页
开发环境:win10家庭中文版,vs2013,qt5.5.1
目的:使用webkit加载web页面代码如下:
#include
#include
#ifdef _DEBUG#pragma comment(lib, "Qt5WebKitWidgetsd.lib")
#pragma comment(lib, "Qt5WebKitd.lib")
#else
#pragma comment(lib, "Qt5WebKitWidgets.lib")
#pragma comment(lib, "Qt5WebKit.lib")
#endifm_WebView = new QWebView(this);
QWebSettings * settings = m_WebView->settings();
QWebSettings::globalSettings();
settings->setAttribute(QWebSettings::PluginsEnabled, true);
settings->setAttribute(QWebSettings::JavaEnabled, true);
settings->setAttribute(QWebSettings::JavascriptEnabled, true);
settings->setAttribute(QWebSettings::JavascriptCanOpenWindows, true);
settings->setAttribute(QWebSettings::JavascriptCanAccessClipboard, true);
settings->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
settings->setAttribute(QWebSettings::SpatialNavigationEnabled, true);
settings->setAttribute(QWebSettings::LinksIncludedInFocusChain, true);
settings->setAttribute(QWebSettings::AcceleratedCompositingEnabled, true);
settings->setAttribute(QWebSettings::AutoLoadImages, true);
编译程序,使用dependency检测依赖动态库库,然后启动程序,加载网页一切正常,当加载视频和音频时出现异常,腾讯视频出现图1所示情况,爱奇艺 和优酷视频出现情况如图2,经过各种尝试,最终发现需要在exe同级目录下放置plugins文件夹,文件夹底下放置flash动态库 (NPSWF32.dll),或者自己下载一个动态库安装,这个动态库是firefox的flash player,测试结果如图3
图1腾讯视频
图2 爱奇艺测试结果
图3下载flash插件上图3中的测试结果是在win7虚拟机上测试结果,win10上安装firefox的flash插件测试结构和上图一样
顺道说句:QT插件库(新增库,路径必须正确),根据不同的程序,需要不同的插件库例如:1、使用QMediaPlayer需要添加plugins目录下的mediaservice文件夹下的动态库2、使用除png外其他图片文件时,需要保护相应的图片插件动态库
QWebView加载网页的更多相关文章
- Qt加载网页(加载浏览器插件)和制作托盘后台运行(南信大财务报账看号)
程序模块要添加QNetWork和QWebKit模块: nuistfinancevideo.h文件: #ifndef NUISTFINANCEVIDEO_H #define NUISTFINANCEVI ...
- Android中Http加载如何得到Cookie和 WebView 加载网页如何得到的Cookie
最近做项目在手机端登录Http请求和 WebView 记载登录获取Cookie信息,可查看Cookie信息. 如图: Http请求获取Cookie信息: public static String re ...
- Android中使用WebView, WebChromeClient和WebViewClient加载网页 (能够执行js)
Android中使用WebView, WebChromeClient和WebViewClient加载网页 在android应用中,有时要加载一个网页,如果能配上一个进度条就更好了,而android ...
- 解决Github使用Fastly CDN而导致不能加载网页的方法 转自 沙丘:http://www.enkoo.net/fastly-cdn-in-gifhub.html
Github现在基本属于“安全”网站,但Github使用fastly.net的CDN服务后,其网站在国内经常不能正常加载网页.github.global.ssl.fastly.net的亚洲IP一般为1 ...
- UIWebView 加载网页、文件、 html-b
UIWebView 是用来加载加载网页数据的一个框.UIWebView可以用来加载pdf word doc 等等文件 生成webview 有两种方法,1.通过storyboard 拖拽 2.通过al ...
- C# winform 加载网页 模拟键盘输入自动接入访问网络
声明: 本文原创,首发于博客园 http://www.cnblogs.com/EasyInvoice/p/6070563.html 转载请注明出处. 背景: 由于所在办公室网络限制,笔者每天都使用网络 ...
- android WebView, WebChromeClient和WebViewClient加载网页基本用法
WebView, WebChromeClient和WebViewClient加载网页基本用法 webview是android中的浏览器控件,在一些手机应用中常会用到b/s模式去开发应用,这时webvi ...
- 解决Github使用Fastly CDN而导致不能加载网页的方法
Github现在基本属于“安全”网站,但 Github使用fastly.net的CDN服务后,其网站在国内经常不能正常加载网页.github.global.ssl.fastly.net的亚洲IP一般为 ...
- bootstrap模态框远程加载网页的正确处理方式
bootstrap模态框远程加载网页的方法 在bootsrap模态框文档里给出了这个方法: 使用链接模式 <a data-toggle="modal" href=" ...
随机推荐
- Codeforces 438E. The Child and Binary Tree 多项式,FFT
原文链接www.cnblogs.com/zhouzhendong/p/CF438E.html 前言 没做过多项式题,来一道入门题试试刀. 题解 设 $a_i$ 表示节点权值和为 $i$ 的二叉树个数, ...
- Eclipse 那些小技巧(值得收藏)
1.菜单命令系列 Edit→content Assist→add Alt+/ 代码关联 Windows→Next Editor→add Ctrl+Tab 切换窗口 Run→Debug Toggle L ...
- 在VUE-CLI 3下的第一个Element-ui项目(菜鸟专用)
vue-cli3.0使用及配置 (https://www.cnblogs.com/xzqyun/p/10779891.html ) 以上是 vue-cli3.0使用及配置 这里我们来引用基于v ...
- poj1681 Network
题目链接 https://cn.vjudge.net/problem/17712/origin Andrew is working as system administrator and is pla ...
- Unreal 4 error 记录
1.打包出来的exe,黑屏 这种最大的可能是在“地图&模式中”将 Default Maps设置为自己的map,注意这里分为Editor Startup Map和Game Default Map ...
- C++ MD5类封装
c++ md5 算法封装 md5.h #ifndef MD5_H #define MD5_H #include <string> #include <fstream> /* T ...
- Core Location实现定位
2013/4/22记录: 注意:如非必要,不应该多次轮询位置信息i 使用时,可根据需要制定精度,通过仔细制定所需的绝对最低精度级别,可以纺织不必要的电池消耗. 导入:CoreLocation.f ...
- 简单的NIO使用实例
public class ThreadTest_2 { public static void main(String[] args) { Thread downloaderThread = null; ...
- summary of week
Summary of week Catalog 计算机基础 解释器 编码 数据类型 输入 输出 变量 注释 运算符 条件判断 循环 Content 计算机基础 计算机组成 软件 解释器 操作系统 : ...
- 10-HTTPServletReauest和HTTPServletResponse
Servlet配置方式 1. 全路径匹配 以 / 开始 /a /aa/bb localhost:8080/项目名称/aa/bb 2. 路径匹配 , 前半段匹配 以 / 开始 , 但是以 * 结束 /a ...