作者热门文章
- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
请帮助我想将 webkit 移植到 WebEngine 但我有一些问题,我有一个信号 javaScriptWindowObjectCleared() 新的 qt 5.10 无法识别。在这种情况下,什么可以帮助我?
connect( this->page(), SIGNAL( javaScriptWindowObjectCleared() ), SLOT( OnPopulateJavaScriptObjec() ) );
最佳答案
以下代码片段可能对您有所帮助。
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.
关于c++ - javaScriptWindowObjectCleared() 在新 qt 5.10 上的替代方案是什么?在 qt 5.10 上无法识别 javaScriptWindowObjectCleared,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48686800/
请帮助我想将 webkit 移植到 WebEngine 但我有一些问题,我有一个信号 javaScriptWindowObjectCleared() 新的 qt 5.10 无法识别。在这种情况下,什么
我是一名优秀的程序员,十分优秀!