September 13, 2011

fmontigny fmontigny
Lab Rat
20 posts

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 ?

  1. import Qt 4.7
  2. import QtWebKit 1.0
  3.  
  4.  Flickable {
  5.     id: flickable
  6.     anchors.fill: parent
  7.     contentWidth: webView.width
  8.     contentHeight: webView.height
  9.     focus: true
  10.  
  11.     WebView {
  12.         id: webView
  13.         url: "http://www.google.fr"
  14.         //focus: true
  15.         /*onActiveFocusChanged: {
  16.             console.log("[QML] Action -- active focus "+activeFocus+" -- WebKit.qml")
  17.             if(activeFocus)
  18.                 osk.isStandardKeys(false)
  19.             else
  20.                 osk.exitProgram()
  21.         }*/
  22.  
  23.         Keys.onPressed:{ console.log("Key pressed"); }
  24.  
  25.         preferredWidth: flickable.width
  26.         preferredHeight: flickable.height
  27.         contentsScale: 1
  28.  
  29.         onAlert: console.log(message)
  30.  
  31.         onLoadFinished: {
  32.             var isFlickable = webView.evaluateJavaScript("$('input[type=text]').select(function() {alert('Handler for .focus() called.'); window.qml.showKeyBoard()});");
  33.         }
  34.  
  35.         javaScriptWindowObjects:QtObject {
  36.             WebView.windowObjectName: "qml"
  37.             function showKeyBoard() { osk.isStandardKeys(false); }
  38.         }
  39.     }
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46. }

 Signature 

fmontigny

“time is for all cannot simultaneously”

[FRANCE]

2 replies

September 14, 2011

mbrasser mbrasser
Lab Rat
452 posts

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

September 14, 2011

Konstantin Podsvirov Konstantin Podsvirov
Hobby Entomologist
95 posts

See bug QTBUG-7369 [bugreports.qt.nokia.com] (Flickable/MouseArea should handle mouse wheel events).

 
  ‹‹ QMediaRecorder to record video and audio      QT 4.7.4 SDK 1.1.3 error : QColor::setNamedColor: Unknown color name ’...’ ››

You must log in to post a reply. Not a member yet? Register here!