QtWebKit/QtWebEngine移植差异(网摘)
QtWebKit/QtWebEngine移植差异
原文出处:【wiki.qt.io】
This guide gives an overview of the differences between the Qt WebKit and Qt WebEngine APIs in applications.
This intends to provide rough steps to follow when porting an application using Qt WebKit's QWebView API to use Qt WebEngine's QWebEngineView.
Class names
The Qt WebEngine equivalent of Qt WebKit C++ classes are prefixed by QWebEngine instead of QWeb.
Qt WebKit |
---|
#include <QWebHistory> |
Qt WebEngine |
#include <QWebEngineHistory> |
Qt module name
In qmake project files
Qt WebKit |
---|
QT += webkitwidgets |
Qt WebEngine |
QT += webenginewidgets |
Including the module in source files
Qt WebKit |
---|
#include <QtWebKit> |
Qt WebEngine |
#include <QtWebEngineWidgets> |
QWebFrame has been merged into QWebEnginePage
It is not possible to access sub-frames. Methods of the main QWebFrame are now available directly through the QWebEnginePage itself.
Qt WebKit |
---|
QWebPage page; |
Qt WebEngine |
QWebEnginePage page; |
Some methods now return their result asynchronously
Since Qt WebEngine uses a multi-process architecture, the application needs to return to the event loop where the result will be received asynchronously from Qt WebEngine's render process. A function pointer, a functor or a lambda expression must be provided to handle the result when it is available.
Qt WebKit |
---|
QWebPage *page = new QWebPage; |
Qt WebEngine (with a lambda function in C++11) |
QWebEnginePage *page = new QWebEnginePage; |
Qt WebEngine (with a functor template wrapping a member function) |
template<typename Arg, typename R, typename C> |
Qt WebEngine (with a regular functor) |
struct SetPlainTextFunctor { |
Qt WebEngine does not interact with QNetworkAccessManager
Some classes of Qt Network like QAuthenticator were reused for their interface but, unlike Qt WebKit, Qt WebEngine has its own HTTP implementation and can't go through a QNetworkAccessManager.
Signals and methods of QNetworkAccessManager that are still supported were moved to QWebEnginePage directly.
Qt WebKit |
---|
QNetworkAccessManager qnam; |
Qt WebEngine |
QWebEnginePage page; |
Notes about individual methods
runJavaScript (QWebEnginePage)
QWebFrame::evaluateJavaScript was renamed and moved to the QWebEnginePage. It is currently only possible to run JavaScript on the main frame of a page and the result is returned asynchronously to the provided functor.
Qt WebKit |
---|
QWebPage *page = new QWebPage; |
Qt WebEngine (with lambda expressions in C++11) |
QWebEnginePage *page = new QWebEnginePage; |
setHtml and setContent (QWebEnginePage)
Those methods now perform asynchronously the same way as a normal HTTP load would.
Unavailable Qt WebKit APIs
Qt WebKit classes or methods in this list will not be available in Qt WebEngine.
QGraphicsWebView
Qt WebEngine requires hardware acceleration. Since we couldn't support a web view class in a QGraphicsView unless it is attached to a QGLWidget viewport, this feature is out of scope.
QWebElement
Qt WebEngine uses a multi-process architecture and this means that any access to the internal structure of the page has to be done asynchronously, any query result must be returned through callbacks. The QWebElement API was designed for synchronous access and this would require a complete redesign.
QWebPage::setLinkDelegationPolicy
There is no way to connect a signal to run C++ code when a link is clicked.
QWebDatabase
The Web SQL Database feature that this API was wrapping in QtWebKit was dropped from the HTML5 standard.
QWebPluginDatabase, QWebPluginFactory, QWebPluginInfo, QWebPage::setPalette, QWebView::setRenderHints
Qt WebEngine renders web pages using Skia and isn't using QPainter or Qt for this purpose. The HTML5 standard also now offers much better alternatives that were not available when native controls plugins were introduced in QtWebKit.
QWebHistoryInterface
Visited links are persisted automatically by Qt WebEngine.
QWebPage::setContentEditable
In the latest HTML standard, any document element can be made editable through the contentEditable attribute. So runJavaScript is all that is needed.
page->runJavascript("document.documentElement.contentEditable = true")
QtWebKit/QtWebEngine移植差异(网摘)的更多相关文章
- Feedly订阅Blog部落格RSS网摘 - Blog透视镜
网络信息爆炸的时代,如何更有效率地阅读文章,订阅RSS网摘,可以快速地浏览文章标题,当对某些文章有兴趣时,才点下连结连到原网站,阅读更详细的文章,Feedly Reader阅读器除了提供在线版订阅RS ...
- Bloglines订阅Blog部落格RSS网摘 - Blog透视镜
网络信息蓬勃发展,Blog部落格越来越普及,如果逐一地去浏览网站,势必费时费力,倘若信息可以自己送上门,那就可以节省不少时间,就好像看报纸的标题,有兴趣才点连结,进到网站浏览文章内容,Blogline ...
- TCP/IP协议头部结构体(网摘小结)(转)
源:TCP/IP协议头部结构体(网摘小结) TCP/IP协议头部结构体(转) 网络协议结构体定义 // i386 is little_endian. #ifndef LITTLE_ENDIAN #de ...
- Vim命令快捷键(网摘)
Vim命令快捷键(网摘) 原文出处:[?---->home]
- c#与C++类型转换网摘
转载自 C++和C#转换 https://www.cnblogs.com/zjoch/p/4147182.html c#与C++类型转换,网摘 //c++:HANDLE(void *) ...
- Delphi 中DataSnap技术网摘
Delphi2010中DataSnap技术网摘 一.为DataSnap系统服务程序添加描述 这几天一直在研究Delphi 2010的DataSnap,感觉功能真是很强大,现在足有理由证明Delphi7 ...
- Python入门及容易!网摘分享给大家!
Python:Python学习总结 背景 PHP的$和->让人输入的手疼(PHP确实非常简洁和强大,适合WEB编程),Ruby的#.@.@@也好不到哪里(OO人员最该学习的一门语言). Pyth ...
- KEIL建立新唐MCU的工程时,移植官网程序报错变量未定义问题解决方法
最近在使用新唐的MCU,新唐的MCU使用还算方便,你安装好KEIL之后再安装 Nu-Link_Keil_Driver_V3.00.6909 驱动即可建立新唐的MCU工程,注意的是因为新唐MCU是C51 ...
- 采访ServiceStack的项目领导Demis Bellot——第1部分(网摘)
ServiceStack是一个开源的.支持.NET与Mono平台的REST Web Services框架.InfoQ有幸与Demis Bellot深入地讨论了这个项目.在这篇两部分报道的第1部分中,我 ...
随机推荐
- laravel5.4+vue+element-ui配置及简单使用
前言:网上能找到的关于这个方面的教程实在是太少啦,所以踩了好多坑,特意来分享一下,原创哦.想要打包带走的小伙伴还请注明出处
- (转载)CloseableHttpClient设置Timeout
参考文档: http://blog.csdn.net/zheng0518/article/details/46469051 https://segmentfault.com/a/11900000005 ...
- maven Spring+Spring MVC+Mybatis+mysql轻量级Java web开发环境搭建
之前一直在做的一个GIS系统项目,采用了jsp+servlet框架,数据传输框架采用了apache的thrift框架,短时多传的风格还不错,但是较其他的java web项目显得有点太臃肿了,现在给大家 ...
- 解决QZ-SDK静态库libRPToolLib.a中avfoundation.o文件和kxMovie依赖的ffmpeg静态库libavdevice.a函数重复定义的问题
解决QZ-SDK静态库libRPToolLib.a中avfoundation.o文件和kxMovie依赖的ffmpeg静态库libavdevice.a函数重复定义的问题 在原来项目中导入全志v3相机的 ...
- 一颗简单的JDBC栗子
前言:安装好数据库之后,我们编写的java程序是不能直接使用数据库的,而JDBC(Java Database Connectivity,即java数据库连接)是java语言里用来规范客户端程序访问数据 ...
- Sass学习笔记(补充)
阅读目录 1. Sass和SCSS的区别 2. @while循环 3. @at-root 4. @content 5. 凸显注释 6. CSS输出样式 7. 重置浏览器样式 8. Sass调试和@de ...
- QTCreator 更改代码高亮主题为 VS+VA助手 风格
VS Dark-VA 主题下载地址 链接:http://pan.baidu.com/s/1jIOeZxc 密码:2gp2 另外还有喜欢 solarized 配色的也可以从这里下载 https ...
- 事务之使用JDBC进行事务的操作
本篇讲述数据库中非常重要的事务概念和如何使用MySQL命令行窗口来进行数据库的事务操作.下一篇会讲述如何使用JDBC进行数据库的事务操作. 事务是指数据库中的一组逻辑操作,这个操作的特点就是在该组逻辑 ...
- Health Check in eShop -- 解析微软微服务架构Demo(五)
引言 What is the Health Check Health Check(健康状态检查)不仅是对自己应用程序内部检测各个项目之间的健康状态(各项目的运行情况.项目之间的连接情况等),还包括了应 ...
- 一步一步学Vue(三)
接上篇,有同事看了我写的博客,觉得我这人不靠谱,文笔太白了,不够严肃,所以这次我一定要做一个严肃的人,写博客要有写博客的态度,第三篇开始我在考虑一个问题,会不会太着急了,要知道Vue的组件化时它的一个 ...