请帮助我想将webkit移植到WebEngine但是我遇到了一些问题,我有一个信号javaScriptWindowObjectCleared(),新qt 5.10无法识别。在这种情况下,有什么可以帮到我?
connect( this->page(), SIGNAL( javaScriptWindowObjectCleared() ), SLOT( OnPopulateJavaScriptObjec() ) );
答案 0 :(得分:0)
以下代码sinppet可能会对您有所帮助。
QWebEngineScript toBeInjectedjs;
toBeInjectedjs.setName("qwebchannel.js");
toBeInjectedjs.setInjectionPoint(QWebEngineScript::DocumentCreation); //important
toBeInjectedjs.setRunsOnSubFrames(false);
toBeInjectedjs.setWorldId(QWebEngineScript::MainWorld);
toBeInjectedjs.setSourceCode(jsStr); //jsStr is what your want to inject to page;
scripts().insert(toBeInjectedjs); //scripts is a member function of QWebEnginePage.