当前位置:网站首页>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崩溃问题:
边栏推荐
- A week of short video platform 30W exposure, small magic push helps physical businesses turn losses into profits
- 机器学习-感知机模型
- The computer comes with software to make the background color of the picture transparent (matting white background)
- The macrogenome microbiome knowledge you want is all here (2022.7)
- How to choose the right kubernetes storage plug-in? (09)
- pwm呼吸燈
- 隐私计算技术创新及产业实践研讨会:学习
- 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
- Serial port controls steering gear rotation
- Cell:清华程功组揭示皮肤菌群的一种气味挥发物促进黄病毒感染宿主吸引蚊虫...
猜你喜欢

PhD battle-11 preview | review and prospect backdoor attack and defense of neural network

七张图,学会做有价值的经营分析
![[cloud native] briefly talk about the understanding of flume, a massive data collection component](/img/2d/8c4769e97fb84e98eafb7069551341.png)
[cloud native] briefly talk about the understanding of flume, a massive data collection component

Exploration of mobile application performance tools

Configure MySQL under Linux to authorize a user to access remotely, which is not restricted by IP
![john爆破出現Using default input encoding: UTF-8 Loaded 1 password hash (bcrypt [Blowfish 32/64 X3])](/img/4c/ddf7f8085257d0eb8766dbec251345.png)
john爆破出現Using default input encoding: UTF-8 Loaded 1 password hash (bcrypt [Blowfish 32/64 X3])
![john爆破出现Using default input encoding: UTF-8 Loaded 1 password hash (bcrypt [Blowfish 32/64 X3])](/img/4c/ddf7f8085257d0eb8766dbec251345.png)
john爆破出现Using default input encoding: UTF-8 Loaded 1 password hash (bcrypt [Blowfish 32/64 X3])

Seven charts, learn to do valuable business analysis

How openharmony starts FA of remote devices

【Leetcode】14. Longest Common Prefix
随机推荐
二、mock平台的扩展
John blasting appears using default input encoding: UTF-8 loaded 1 password hash (bcrypt [blowfish 32/64 x3])
Role and function of uboot
What is generics- Introduction to generics
C语言自定义函数的方法
Yolov5 practice: teach object detection by hand
使用知行之桥的API端口,提供资源供合作伙伴访问
Executive engine module of high performance data warehouse practice based on Impala
R and rstudio download and installation tutorial (super detailed)
Kubernetes three open interfaces first sight
2、 Expansion of mock platform
A week of short video platform 30W exposure, small magic push helps physical businesses turn losses into profits
【Leetcode】13. Roman numeral to integer
Global and Chinese market of switching valves 2022-2028: Research Report on technology, participants, trends, market size and share
Digital IC hand tearing code -- voting device
Penetration tool - intranet permission maintenance -cobalt strike
Easy language ABCD sort
Go zero micro service practical series (VIII. How to handle tens of thousands of order requests per second)
uboot的作用和功能
Just a coincidence? The mysterious technology of apple ios16 is even consistent with the products of Chinese enterprises five years ago!