[Qtwebengine] How to tell qtwebengine a result string from javascript timer?

Koehne Kai Kai.Koehne at theqtcompany.com
Tue Dec 15 11:57:59 CET 2015



> -----Original Message-----
> From: QtWebEngine [mailto:qtwebengine-bounces at qt-project.org] On
> Behalf Of Nemo
> Sent: Tuesday, December 15, 2015 10:47 AM
> To: qtwebengine <qtwebengine at qt-project.org>
> Subject: [Qtwebengine] How to tell qtwebengine a result string from
> javascript timer?
> 
> Hello everyone.
> 
> I used runJavaScript(const QString& scriptSource, const
> QWebEngineCallback<const QVariant &> &resultCallback), the javascript
> start a timer and do something until operation is really done. But the
> "resultCallback" will be called immediately, how can I return the result in
> javascript timer?

Consider using QWebChannel to allow bi-directional communication between JS and C++.

See e.g. https://doc-snapshots.qt.io/qt5-5.6/qtwebengine-webenginewidgets-markdowneditor-example.html for a complete example.

Regards

Kai



More information about the QtWebEngine mailing list