当前位置:网站首页>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崩溃问题:
边栏推荐
- 国内比较好的OJ平台[通俗易懂]
- 一文看懂:数据指标体系的4大类型
- A week of short video platform 30W exposure, small magic push helps physical businesses turn losses into profits
- TCP server communication process (important)
- La boîte de connexion du hub de l'unit é devient trop étroite pour se connecter
- [error record] the connection of the flutter device shows loading (disconnect | delete the shuttle/bin/cache/lockfile file)
- 大廠面試總結大全
- Exploration of mobile application performance tools
- 几行代码搞定RPC服务注册和发现
- Exploration and practice of integration of streaming and wholesale in jd.com
猜你喜欢
随机推荐
IP address translation address segment
什么是泛型?- 泛型入门篇
P6774 [NOI2020] 时代的眼泪(分块)
The poor family once again gave birth to a noble son: Jiangxi poor county got the provincial number one, what did you do right?
System Verilog实现优先级仲裁器
Global and Chinese markets for disposable insulin pumps 2022-2028: Research Report on technology, participants, trends, market size and share
关于举办科技期刊青年编辑沙龙——新时代青年编辑应具备的能力及提升策略的通知...
MySQL port
⌈ 2022 ⌋ how to use webp gracefully in projects
[fluent] dart data type list set type (define set | initialize | generic usage | add elements after initialization | set generation function | set traversal)
GeoServer:发布PostGIS数据源
Understand one article: four types of data index system
Exploration of mobile application performance tools
【云原生】简单谈谈海量数据采集组件Flume的理解
< IV & gt; H264 decode output YUV file
国内比较好的OJ平台[通俗易懂]
【Leetcode】13. 罗马数字转整数
Amazon cloud technology community builder application window opens
Role and function of uboot
七张图,学会做有价值的经营分析