当前位置:网站首页>QWebEngineView崩溃及替代方案
QWebEngineView崩溃及替代方案
2022-07-02 14:21:00 【荆楚闲人】
近期项目中需要采用Qt展示网页功能,于是就想到了QWebEngineView类,但是QWebEngineView有时能运行,有时又会崩溃,如下:
但Qt官方自带的例子即Qt安装目录下的Examples\Qt-X.XX.X\webenginewidgets( 其中X为Q版本号)不崩溃,为何自己的会崩溃,网上也有很多人提到崩溃的问题。在windows下可用下述方法解决:
不用QWebEngineView,而采用微软的Microsoft Web Browser的ocx控件替代QWebEngineView,如下是代码:
auto webWidget = new QAxWidget;
//设置ActiveX控件为IEMicrosoft Web Browser
//设置ActiveX控件的id,最有效的方式就是使用UUID
//此处的{8856F961-340A-11D0-A96B-00C04FD705A2}就是Microsoft Web Browser控件的UUID
webWidget->setControl(QString::fromUtf8("{8856F961-340A-11D0-A96B-00C04FD705A2}"));
webWidget->setObjectName(QString::fromUtf8("webWidget"));//设置控件的名称
webWidget->setFocusPolicy(Qt::StrongFocus);//设置控件接收键盘焦点的方式:鼠标单击、Tab键
webWidget->setProperty("DisplayAlerts", false); //不显示任何警告信息。
webWidget->setProperty("DisplayScrollBars", true); // 显示滚动条
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(webWidget);
setLayout(mainLayout);
// 加载百度主页
webWidget->dynamicCall("Navigate(const QString&)", "http://www.baidu.com");
setWindowState(Qt::WindowMaximized);//最大化
说明:下面链接的文章都不能解决QWebEngineView崩溃问题:
边栏推荐
- System Verilog实现优先级仲裁器
- [leetcode] 14. Préfixe public le plus long
- 社交元宇宙平台Soul冲刺港股:年营收12.8亿 腾讯是股东
- Notice on holding a salon for young editors of scientific and Technological Journals -- the abilities and promotion strategies that young editors should have in the new era
- System Verilog implements priority arbiter
- 相信自己,这次一把搞定JVM面试
- Global and Chinese markets of stainless steel surgical suture 2022-2028: Research Report on technology, participants, trends, market size and share
- Analysis of how to prevent virus in industrial computer
- 【征文活动】亲爱的开发者,RT-Thread社区喊你投稿啦
- Just a coincidence? The mysterious technology of apple ios16 is even consistent with the products of Chinese enterprises five years ago!
猜你喜欢
Seal Library - installation and introduction
Interpretation of key parameters in MOSFET device manual
Configure ARP table entry restrictions and port security based on the interface (restrict users' private access to fool switches or illegal host access)
Notice on holding a salon for young editors of scientific and Technological Journals -- the abilities and promotion strategies that young editors should have in the new era
PhD Debate-11 预告 | 回顾与展望神经网络的后门攻击与防御
L'explosion de John utilise l'encodage d'entrée par défaut: UTF - 8 Loaded 1 password Hash (bcrypt [blowfish 32 / 64 X3])
Error when uploading code to remote warehouse: remote origin already exists
Yolov5 practice: teach object detection by hand
Tech talk activity preview | building intelligent visual products based on Amazon kVs
Dgraph: large scale dynamic graph dataset
随机推荐
PhD battle-11 preview | review and prospect backdoor attack and defense of neural network
GeoServer:发布PostGIS数据源
学习周刊-总第60期-2022年第25周
Cell:清华程功组揭示皮肤菌群的一种气味挥发物促进黄病毒感染宿主吸引蚊虫...
go-zero微服务实战系列(八、如何处理每秒上万次的下单请求)
Atcoder beginer contest 169 (B, C, D unique decomposition, e mathematical analysis f (DP))
<四> H264解码输出yuv文件
Detailed explanation of @accessories annotation of Lombok plug-in
IP地址转换地址段
Digital IC hand tearing code -- voting device
OpenHarmony如何启动远程设备的FA
福元医药上交所上市:市值105亿 胡柏藩身价超40亿
Classic quotations
几行代码搞定RPC服务注册和发现
Exploration of mobile application performance tools
Understand one article: four types of data index system
[fluent] dart data type list set type (define set | initialize | generic usage | add elements after initialization | set generation function | set traversal)
john爆破出現Using default input encoding: UTF-8 Loaded 1 password hash (bcrypt [Blowfish 32/64 X3])
js删除字符串中的子串
易语言abcd排序