Qt QWebEngineView花屏和右键菜单无法弹出的bug

bug出现原因

QWebEngineView控件由于使用了opengl,在某些电脑上可能由于opengl的驱动过低会导致花屏或者各种奇奇怪怪的问题,比如showfullscreen的情况下鼠标右键失效,需要在main函数启用软件opengl渲染。

 

解决办法

方法一

#if (QT_VERSION > QT_VERSION_CHECK(5,4,0))

//下面两种方法都可以,Qt默认采用的是AA_UseDesktopOpenGL

QCoreApplication::setAttribute(Qt::AA_UseOpenGLES);

//QCoreApplication::setAttribute(Qt::AA_UseSoftwareOpenGL);

#endif

方法二

QRect rect = qApp->desktop()->geometry();

rect.setY(-1);

rect.setHeight(rect.height());

this->setGeometry(rect);

 

 

版权声明:
作者:小何
链接:https://ligo100.cn/houduanjishu/qt/47.html
来源:小何博客
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
打赏
< <上一篇
下一篇>>
文章目录
关闭
目 录