I have create a HTML5 App from Ubuntu SDK. It contains a index.html and js directory. Next I add "X" label on the html file like this:
<head>
...
<style type="text/css">
#quit { background-color: gray; color: white; font-weight: bold; display: block; text-align: right; }
</style>
</head>
<body>
<a id="quit">X</a>
...
</body>
The wanted effect is when “X” label is clicked, the Qt.quit() will be called and the app window be closed. Unfortunately, it won't. The app is launched by "ubuntu-html5-app-launcher" (contained in package "ubuntu-html5-theme"). So, how to modify ubuntu-html5-app-launcher to let the html5 app do something as well as native apps, for example, just close the window when we click the item defined in the html file?
FYI: I found if I choose "Applications >> HTML5 Application" template from "New file or project" menu in the SDK, Qt.quit() can be called by html file (thru addToJavaScript function):
void Html5ApplicationViewerPrivate::addToJavaScript()
{
m_webView->page()->mainFrame()->addToJavaScriptWindowObject("Qt", this);
}
However "Applications >> HTML5 Application" type app cannot transfer some events such as mouse over and mouse move to the built-in WebView, as a result, when user move mouse on and over the elements of the html, nothing will happen unless you click the elements.
So my questions are:
How to make html5 apps launched by ubuntu-html5-app-launcher to call qt functions within html file. Namely how to modify ubuntu-html5-app-launcher
OR
How to make "Applications >> HTML5 Application" type apps to transfer specified events, such as mouse move and over, to the built-in html file loaded by C++ class (in my demo is Html5ApplicationViewer inherit form QWidget)