Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Webview keys navigation
Forum Updated to NodeBB v4.3 + New Features

Webview keys navigation

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 2.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    muchasuerte
    wrote on 21 Jul 2011, 10:17 last edited by
    #1

    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: {
            if (event.key == Qt.Key_PageDown)
            {
                flickable.contentY =  Math.min(  flickable.contentY + 10, web_view1.height - flickable.height );
            }
            if (event.key == Qt.Key_PageUp)
            {
                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 );
                }
    
            }
        ]
    }
    

    }
    @

    1 Reply Last reply
    0

    1/1

    21 Jul 2011, 10:17

    • Login

    • Login or register to search.
    1 out of 1
    • First post
      1/1
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved