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

Nemo 377307289 at qq.com
Thu Dec 17 03:17:08 CET 2015


Thank you Koehne Kai, it is helpful.


------------------ Original ------------------
From:  "Koehne Kai";<Kai.Koehne at theqtcompany.com>;
Date:  Tue, Dec 15, 2015 06:57 PM
To:  "Nemo"<377307289 at qq.com>; "qtwebengine"<qtwebengine at qt-project.org>; 

Subject:  RE: [Qtwebengine] How to tell qtwebengine a result string fromjavascript timer?





> -----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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qtwebengine/attachments/20151217/bda954d5/attachment.html>


More information about the QtWebEngine mailing list