WebEngineScript sourceUrl: Can't open user script



  • I have tried to insert the qwebchannel.js script as WebEngineScript within a WebEngineView:

    WebEngineView {
        id: webbrowser02
        WebEngineScript {
            injectionPoint: WebEngineScript.DocumentCreation
            id: qwebchannel
            sourceUrl: "qrc:///qwebchannel.js"
            worldId: WebEngineScript.MainWorld
        }
        userScripts: [qwebchannel]
    }
    

    The script file qwebchannel.js is defined within the resources:

    <RCC>
        <qresource>
            <file>main.qml</file>
            <file>qwebchannel.js</file>
        </qresource>
    </RCC>
    

    Then, as I try to start, I've got the message:

    QFSFileEngine::open: No file name specified
    Can't open user script  QUrl("qrc:///qwebchannel.js")
    

    What' going wrong? I'm using Qt 5.5 with QtWebView 1.1


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.