How to get the virtual keyboard to appear when a text field is tapped
-
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?
-
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.
-
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? -
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.
-
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/