Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt WebKit
  4. How to get the virtual keyboard to appear when a text field is tapped
Forum Updated to NodeBB v4.3 + New Features

How to get the virtual keyboard to appear when a text field is tapped

Scheduled Pinned Locked Moved Qt WebKit
5 Posts 4 Posters 6.7k 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.
  • C Offline
    C Offline
    ChickenDuck
    wrote on last edited by
    #1

    Hello

    I am very new to Qt WebKit. Sorry if this is a very obvious question, but I've been trying to figure it out for a few hours and have made no progress.

    I have an embedded linux c++ application that uses a QWebView object. We have a touch screen, but no mouse or keyboard on our product. I would like to have the virtual keyboard show up when a I tap on a text field. Instead, what I see is that the cursor is placed where I've tapped, and the text field is awaiting input. For debug purposes, I tried hooking up a USB keyboard, and sure enough when I type the text shows up in the text field.

    Do I need to tell the webkit object that there is no physical keyboard in our system, and to always show the virtual keyboard? Or is there some simple javascript I can run to show the virtual keyboard when the user taps the field?

    1 Reply Last reply
    0
    • N Offline
      N Offline
      nvharisha
      wrote on last edited by
      #2

      If you look at the QWebView, there is
      @virtual void keyPressEvent ( QKeyEvent * ev )@

      You create your own webview from the QWebView and re-implement keypressevent, depending on type of key, "Editable Field" , then launch a Virtual KB. This virtualkb can be another QWindow or QDialog or how ever you want to the design.

      From here its how you want to implement.

      Hari

      1 Reply Last reply
      0
      • T Offline
        T Offline
        twicave
        wrote on last edited by
        #3

        Is virtual_KB a widget included in QT webkit?
        I tried a 3rd party virtual keyboard.It's very annoyed that when you tap a virtual key, the virtual keyboard widget will be set as active window. so the widget need to be input will lose focus.
        any advice?

        1 Reply Last reply
        0
        • C Offline
          C Offline
          ChickenDuck
          wrote on last edited by
          #4

          Thanks for the response hari. I have tried overriding keyPressEvent in my object which inherits QWebView, but I do not get the keyPressEvent. I think that's the problem...there's no virtual keyboard to generate the keyPressEvent.

          After some digging around, I found I could trap the request to bring up the virtual keyboard by adding this to my QWebView-derived class:

          @ bool event( QEvent *e )
          {
          bool returnValue = QWebView::event(e);
          if (e->type()==QEvent::RequestSoftwareInputPanel)
          {
          fprintf(stderr,"Software Input Panel Requested\n");
          // Now what ?

              }
              return returnValue;
          }@
          

          So now the question is...how do I bring up Qt's virtual keyboard? Is there one built-in, or do I have to implement this somehow? Seems this must be a pretty common thing to do so hopefully there is already something pre-existing?

          Thanks for any advice.

          1 Reply Last reply
          0
          • C Offline
            C Offline
            conny
            wrote on last edited by
            #5

            I don't know much about that, but I know that Qt has no virtual keyboard build in. On the N9 the open-source keyboard Maliit was used. https://wiki.maliit.org/

            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