How to response html5 events from qt5
-
I have a html5 application with buttons.
i want to response to clicked events (for example...) by qt5.
how i do it?
may be by webKit? how i do it? -
Hi,
Welcome to devnet,
You can with QWebview.
- Load the HTML page using "QWebview":http://qt-project.org/doc/qt-5/qwebview.html
- Make a C++ class derived from QObject which is available to the page using "addToJavaScriptWindowObject":http://qt-project.org/doc/qt-5/qwebframe.html#addToJavaScriptWindowObject. Add a Q_INVOKABLE function to this class.
- In HTML page you can create a JavaScript function which will be able to call the function in C++ class by using the exposed object's name.
- Call this JavaScript function on button click.