Webview keys navigation
can I use arrow keys to move focus in a Webview ?
I have to modify in some way the html property of Webview?
- import QtQuick 1.0
- import QtWebKit 1.0
- Flickable {
- id: flickable
- width: screen.width
- height: screen.height - (toolBar.opacity? toolBar.height:0)
- contentWidth: Math.max(screen.width, web_view1.width)
- contentHeight: Math.max(screen.height, web_view1.height)
- focus: true
- WebView {
- id: web_view1
- focus: true
- x: 0
- y: 0
- settings.javascriptEnabled: true
- settings.linksIncludedInFocusChain: true
- opacity: 1
- url: "http://developer.qt.nokia.com/forums/viewforum/12/"
- onLoadFinished: console.log("Load Finish!")
- onLoadStarted: console.log("Start Loading..." )
- onAlert: console.log(message)
- Keys.onPressed: {
- {
- flickable.contentY = Math.min( flickable.contentY + 10, web_view1.height - flickable.height );
- }
- {
- flickable.contentY = Math.max( flickable.contentY - 10, 0 );
- }
- console.log("browser" + event.key)
- }
- onUrlChanged: {
- flickable.contentX = 0
- flickable.contentY = 0
- }
- preferredWidth: flickable.width
- preferredHeight: flickable.height
- contentsScale: 1
- javaScriptWindowObjects:[
- QtObject {
- WebView.windowObjectName: "qml"
- function qmlCall() {
- console.log("This call is in QML!");
- }
- },
- QtObject {
- WebView.windowObjectName: "console"
- function log(log) {
- console.log("log call: "+ log );
- }
- }
- ]
- }
- }
0 replies
You must log in to post a reply. Not a member yet? Register here!
