默认QCefViewTest代码编译出来的程序无法打开有证书错误的网址,会提示如Error: ERR_CERT_DATE_INVALID(-201)的提示。需要使用一下代码设置cef初始化参数。问题解决
int
main(int argc, char* argv[])
{
QApplication a(argc, argv);
// build QCefConfig
QCefConfig config;
///...
config.addCommandLineSwitchWithValue("--ignore-urlfetcher-cert-requests", "1");
config.addCommandLineSwitchWithValue("--ignore-certificate-errors", "1");
///...
MainWindow w;
w.show();
return a.exec();
}
参考:https://blog.youkuaiyun.com/w_david/article/details/103304036
https://cefview.github.io/QCefView/zh/docs/reference/QCefConfig/