gpt4 book ai didi

c++ - javaScriptWindowObjectCleared() 在新 qt 5.10 上的替代方案是什么?在 qt 5.10 上无法识别 javaScriptWindowObjectCleared

转载 作者:塔克拉玛干 更新时间:2023-11-03 07:41:42 25 4
gpt4 key购买 nike

请帮助我想将 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com