- Code: Select all
ui->setupUi(this);
this->setWindowFlags(Qt::CustomizeWindowHint|Qt::FramelessWindowHint);
ui->verticalLayout->addWidget(new QWidget());
HWND wnd = (HWND)ui->widget->winId();
// HWND wnd = (HWND) this->winId();
CefWindowInfo cefWndInfo;
QString strUrl = "https://www.google.com";
RECT winRect;
QDesktopWidget *pDeskTop = QApplication::desktop();
QRect qtRect = pDeskTop->screenGeometry();
winRect.left = qtRect.left();
winRect.top = qtRect.top();
winRect.right = qtRect.right();
winRect.bottom = qtRect.bottom();
cefWndInfo.SetAsChild(wnd, winRect);
CefBrowserSettings cefBrowSetting;
browser_event_ = CefRefPtr<cefclient>(new cefclient(this));
CefRefPtr<CefDictionaryValue> extra_info;
CefRefPtr<CefRequestContext> request_context;
// bool browser = CefBrowserHost::CreateBrowser(cefWndInfo, browser_event_, strUrl.toStdString(), cefBrowSetting, extra_info,request_context);
request_context = CefRequestContext::GetGlobalContext();
bool browser = CefBrowserHost::CreateBrowser(cefWndInfo, browser_event_, strUrl.toStdString(), cefBrowSetting, nullptr,request_context);
connect(ui->btn_go, SIGNAL(clicked()), this, SLOT(on_url()));
showMaximized();
got error in debug log:
FATAL:request_context_impl.cc(151)] Check failed: false. context not valid
and in qt debug mode error occurred here(please refer to the attachment)
cef_request_context_t* _retval = cef_request_context_get_global_context();