I did this, in some abandoned work. Turns out QWebWhatever didn't do it right 
on iOS. It can't return a QVariantMap, you have to stringify it.

Timer {
                id: testTimer
                interval: 1000
                repeat:false
                running: false
                onTriggered: {
                        webview.runJavaScript("try {testResult} catch (e) 
{'undefined'}", function (result) {
                                console.log('object', JSON.stringify(result));
                        });
                        webview.runJavaScript("try {JSON.stringify(testResult)} 
catch (e) {'undefined'}", function (result) {
                                console.log('stringified', 
JSON.stringify(result));
                        });

                }
                onRunningChanged: console.log('running', running);
        }

        WebView {
                id: webview
                anchors.fill: parent
                onLoadProgressChanged: {
                        console.log('loadProgress', loadProgress)
                        if (loadProgress == 100) testTimer.running = true;
                }
        }


> Sent: Wednesday, December 12, 2018 at 3:46 PM
> From: rol...@logikalsolutions.com
> To: interest@qt-project.org
> Subject: [Interest] resturn string to javascript inside QWebEngineView
>
> All,
> 
> Having a massive brain spasm today. Can't remember how to correctly  
> return a string from a function to javascript being run inside of  
> QWebEngineView via QWebChannel. Long ago when I first did this we used  
> QWebSockets but that had horrible nasty side effects and was banned  
> from the project during my absence. Cannot find a link how to do this  
> either.
> 
> It appears the real problem is Javascript isn't recognizing the  
> signature so refuses to call.
_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to