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

WebView

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 3 Posters 3.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.
  • F Offline
    F Offline
    fmontigny
    wrote on last edited by
    #1

    Hi,

    I would to create a custom webkit and osk (virtual key board).
    I want to show the osk when i select a edit text.

    I try :

    • onActiveFocusChanged: but the activeFocus variable show "true" and immediately "false"
    • javascript function $('input[type=text]'): but this don't work with text edit on google page

    Is there another solution ?

    @import Qt 4.7
    import QtWebKit 1.0

    Flickable {
    id: flickable
    anchors.fill: parent
    contentWidth: webView.width
    contentHeight: webView.height
    focus: true

    WebView {
        id: webView
        url: "http://www.google.fr"
        //focus: true
        /*onActiveFocusChanged: {
            console.log("[QML] Action -- active focus "+activeFocus+" -- WebKit.qml")
            if(activeFocus)
                osk.isStandardKeys(false)
            else
                osk.exitProgram()
        }*/
    
        Keys.onPressed:{ console.log("Key pressed"); }
    
        preferredWidth: flickable.width
        preferredHeight: flickable.height
        contentsScale: 1
    
        onAlert: console.log(message)
    
        onLoadFinished: {
            var isFlickable = webView.evaluateJavaScript("$('input[type=text]').select(function() {alert('Handler for .focus() called.'); window.qml.showKeyBoard()});");
        }
    
        javaScriptWindowObjects:QtObject {
            WebView.windowObjectName: "qml"
            function showKeyBoard() { osk.isStandardKeys(false); }
        }
    }
    

    }@

    fmontigny

    "time is for all cannot simultaneously"

    [FRANCE]

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mbrasser
      wrote on last edited by
      #2

      Hi,

      I'm not sure if this is the problem in your case, but removing the focus from Flickable may help -- focus in QML is propogated via focus scopes, rather than parent-child, so the Flickable and WebView may be fighting over the focus. If this is a component in a larger project, it is also possible that the focus has been grabbed elsewhere (e.g. by your osk).

      Regards,
      Michael

      1 Reply Last reply
      0
      • podsvirovP Offline
        podsvirovP Offline
        podsvirov
        wrote on last edited by
        #3

        See bug "QTBUG-7369":https://bugreports.qt.nokia.com/browse/QTBUG-7369 (Flickable/MouseArea should handle mouse wheel events).

        1 Reply Last reply
        0

        • Login

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