-
Notifications
You must be signed in to change notification settings - Fork 191
Open
Labels
Description
Describe the bug 【Bug描述】
按照演示文档,已经成功完成windows系统下的QCefView的使用,但是在Linux系统下无法正常渲染html,如截图所示,红色框体就是加载html的位置。关闭GPU也尝试了,依旧这个问题,跪求大佬帮忙看看!!万分感谢
主要代码
main.cpp
QApplication a(argc, argv);
QCefConfig config;
config.setUserAgent("QCefView_UAVPlatform");
config.setLogLevel(QCefConfig::LOGSEVERITY_DEFAULT);
config.setRootCachePath(QCoreApplication::applicationDirPath() + "/CefView/cef_cache");
config.addCommandLineSwitchWithValue(
"browser-subprocess-path",
QCoreApplication::applicationDirPath() + "/CefView/CefViewWing"
);
config.setBridgeObjectName("CallBridge");
config.setBuiltinSchemeName("CefView");
config.setRemoteDebuggingPort(0);
config.setBackgroundColor(Qt::lightGray);
config.setWindowlessRenderingEnabled(false);
config.addCommandLineSwitch("use-mock-keychain");
// config.addCommandLineSwitch("disable-spell-checking");
// config.addCommandLineSwitch("disable-site-isolation-trials");
// config.addCommandLineSwitch("enable-aggressive-domstorage-flushing");
config.addCommandLineSwitchWithValue("renderer-process-limit", "1");
// config.addCommandLineSwitchWithValue("disable-features", "BlinkGenPropertyTrees,TranslateUI,site-per-process");
QCefContext cefContext(&a, argc, argv, &config);
UAVPlatform w;
w.show();
return a.exec();
实现文件
UAVPlatform::UAVPlatform(QWidget *parent)
: QMainWindow(parent)
{
ui.setupUi(this);
QCefSetting setting;
// setting.setBackgroundColor(QColor::fromRgb(0, 0, 0));
cefViewWidget = new QCefView(QCoreApplication::applicationDirPath() + "/index.html", &setting, this);
QVBoxLayout* layout = new QVBoxLayout(ui.CefWidget);
layout->addWidget(cefViewWidget);
ui.CefWidget->setLayout(layout);
connect(ui.btnOpenDevTools, &QPushButton::clicked, this, &UAVPlatform::OpenDevTools);
connect(cefViewWidget,&QCefView::invokeMethod,this,&UAVPlatform::onInvokeMethod);
connect(cefViewWidget,&QCefView::cefQueryRequest,this,&UAVPlatform::onQCefQueryRequest);
connect(ui.toJs, &QPushButton::clicked, this, &UAVPlatform::onBtnChangeColorClicked);
connect(ui.toJSHaveResult, &QPushButton::clicked, this, &UAVPlatform::onBtnCallJSCodeClicked);
}