WizWebEngineView::WizWebEngineView(QWidget* parent) : QWebEngineView(parent) , m_server(NULL) , m_clientWrapper(NULL) , m_channel(NULL) { WizWebEnginePage* p = new WizWebEnginePage(this); setPage(p); // connect(p, SIGNAL(openLinkInNewWindow(QUrl)), this, SLOT(openLinkInDefaultBrowser(QUrl))); // connect(this, SIGNAL(loadFinished(bool)), this, SLOT(innerLoadFinished(bool))); // // setup the QWebSocketServer m_server = new QWebSocketServer(QStringLiteral("WizNote QWebChannel Server"), QWebSocketServer::NonSecureMode); // if (!m_server->listen(QHostAddress::LocalHost)) { qFatal("Failed to open web socket server."); return; } // wrap WebSocket clients in QWebChannelAbstractTransport objects m_clientWrapper = new WebSocketClientWrapper(m_server); // // setup the channel m_channel = new QWebChannel(); QObject::connect(m_clientWrapper, &WebSocketClientWrapper::clientConnected, m_channel, &QWebChannel::connectTo); }
WizWebEngineView::WizWebEngineView(const WizWebEngineViewInjectObjects& objects, QWidget* parent) : QWebEngineView(parent) { WizWebEnginePage* p = new WizWebEnginePage(objects, this); setPage(p); // connect(p, SIGNAL(openLinkInNewWindow(QUrl)), this, SLOT(openLinkInDefaultBrowser(QUrl))); connect(this, SIGNAL(loadFinished(bool)), this, SLOT(innerLoadFinished(bool))); }