WebView



  • 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); }
        }
    }
    

    }@



  • 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



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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.