May 16, 2012

xardas008 xardas008
Lab Rat
28 posts

virtual keyboard doesn’t open although it exists when focusing TextInput or TextEdit elements.

 

Hi,

I’m trying to open the virtual keyboard when my TextInput element gets focus, but nothing happens.

To clarify what I try to do the following code snippet:

  1. TextInput {
  2.     id: inputName
  3.     text: (inputName.activeFocus) ? "" : qsTr("Please insert some text...")
  4.     activeFocusOnPress: false
  5.     height: 20
  6.     width: 200
  7.  
  8.  
  9.     MouseArea {
  10.         anchors.fill: parent
  11.         onClicked: {
  12.             if(!inputName.activeFocus){
  13.                 inputName.forceActiveFocus();
  14.                 inputName.openSoftwareInputPanel();
  15.             } else {
  16.                 inputName.focus = false;
  17.             }
  18.         }
  19.         onPressAndHold: inputName.closeSoftwareInputPanel();
  20.    }
  21.    anchors.fill: parent
  22. }

The code is just the same as described on this page: http://doc-snapshot.qt-project.org/4.8/qml-textinput.html#openSoftwareInputPanel-method

4 replies

May 16, 2012

ultimodruido ultimodruido
Lab Rat
18 posts

Ciao xardas008
I’m not a guru, but had the same problem. I almost solved it with something like the following:

  1. Rectangle {
  2.     id: lineEdit
  3.     property alias text: input.text  
  4.     [...]
  5.  
  6.     TextInput {
  7.         id: input
  8.         text: "text here"
  9.         [...]
  10.     }
  11.  
  12.     MouseArea {
  13.         anchors.fill: parent
  14.         onClicked: {
  15.             input.focus = true
  16.             input.openSoftwareInputPanel();
  17.         }
  18.     }
  19.  
  20.  
  21.     Keys.onReturnPressed: {
  22.         lineEdit.focus = true
  23.         input.closeSoftwareInputPanel();
  24.     }
  25.  
  26.     Keys.onEnterPressed: {
  27.         lineEdit.focus = true
  28.         input.closeSoftwareInputPanel();
  29.     }
  30. }

with openSoftwareInputPanel() you can force the show up of the virtual keyboard
It seems to work on Symbian Belle, Anna and S60 5th but only on latest SW releases.

Hope this trick works for you as well. I found it somewhere on the forum but cannot find it anymore
bye

May 17, 2012

xardas008 xardas008
Lab Rat
28 posts

This is not very different from my aproach and doesnt work, too. Maybe I need another way on win7 or linux to open a virtual keyboard?

May 17, 2012

ultimodruido ultimodruido
Lab Rat
18 posts

Sorry
my mistake, but this works on mobile solution not on desktop as far as I know.
I have no idea, but a virtual keyboard in window should be a process that you can launch… if you find the name for the program you run it maybe

May 21, 2012

xardas008 xardas008
Lab Rat
28 posts

I just created a Meego app using the Qt Simulator and there it doesn’t work, too.

Maybe it doesn’t work in Qt 4.8?

 
  ‹‹ MouseArea & Multitouch      children vs. resources ››

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