[webkit-qt] Virtual keyboard not shown in WebView input fields

Luca Ottaviano lottaviano at develer.com
Fri Jun 14 04:15:18 PDT 2013


Hi everybody,
I'm using the Maliit virtual keyboard both on desktop and embedded 
platform, but I can't make the keyboard appear when clicking in input 
fields in web pages when using a QML 2 WebView.

With the following QML 2 code the keyboard never shows up when clicking 
on the input field on the web page, while it does if I click on the 
TextInput.

import QtQuick 2.0
import QtWebKit 3.0

Column {
     Rectangle {
         id: bg
         width: 500
         height: 100
         color: "red"
         opacity: 0.8

         TextInput {
             anchors.fill: parent
             text: "test"
         }
     }



     WebView {
         width: 500
         height:300
         url: "https://www.google.com"
     }
}

I'm using Qt 5.0.1 on desktop, but I've tried Qt 5.0.2 on an embedded 
board and the issue is still there.
I can't find anything related on the web, except maybe this bug report:
https://bugs.webkit.org/show_bug.cgi?id=84875

I've looked at the Qt/webkit integration and I'm a bit lost, since the 
code is very different from that report. Also the bug is closed as fixed 
in master, but it seems that such code never hit the Qt5 repo.

Anyway it seems that the tap events are getting in the way of showing up 
the VKB. One way to workaround the problem is to apply the dirty trick 
below; it seems to work fine, but I have no idea of what the 
consequences would be.

In 
qt-everywhere-opensource-src-5.0.2/qtwebkit/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp:

  void QtWebPageEventHandler::doneWithGestureEvent(const 
WebGestureEvent& event, bool wasEventHandled)
  {
      if (event.type() != WebEvent::GestureSingleTap)
          return;

      m_postponeTextInputStateChanged = false;

-    if (!wasEventHandled || !m_webView->hasActiveFocus())
+    if (!m_webView->hasActiveFocus())
          return;

      updateTextInputState();
  }

Is anybody aware of this problem? Am I doing something wrong? Do you 
have any suggestions?

Thanks,
-- 
Luca Ottaviano - lottaviano at develer.com
Develer S.r.l. - http://www.develer.com/
BeRTOS - http://www.bertos.org
.hardware .software .innovation
Tel.: +39 055 3986627 - ext.: 218


More information about the webkit-qt mailing list