forked from cretz/qt_cef_poc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cef_handler.cc
30 lines (26 loc) · 987 Bytes
/
cef_handler.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "cef_handler.h"
CefHandler::CefHandler(QPointer<QMainWindow> main_win,
QPointer<QLineEdit> url_line_edit,
QPointer<QWidget> browser_widg)
: main_win_(main_win),
url_line_edit_(url_line_edit),
browser_widg_(browser_widg) {}
void CefHandler::OnTitleChange(CefRefPtr<CefBrowser> browser,
const CefString &title) {
if (main_win_) {
main_win_->setWindowTitle(QString::fromStdString(title.ToString()) +
" - QT CEF POC");
}
}
void CefHandler::OnAddressChange(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
const CefString &url) {
if (frame->IsMain() && url_line_edit_) {
url_line_edit_->setText(QString::fromStdString(url.ToString()));
}
}
void CefHandler::OnGotFocus(CefRefPtr<CefBrowser> browser) {
if (url_line_edit_) {
url_line_edit_->clearFocus();
}
}