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:
- TextInput {
- id: inputName
- text: (inputName.activeFocus) ? "" : qsTr("Please insert some text...")
- activeFocusOnPress: false
- height: 20
- width: 200
- MouseArea {
- anchors.fill: parent
- onClicked: {
- if(!inputName.activeFocus){
- inputName.forceActiveFocus();
- inputName.openSoftwareInputPanel();
- } else {
- inputName.focus = false;
- }
- }
- onPressAndHold: inputName.closeSoftwareInputPanel();
- }
- anchors.fill: parent
- }
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
Ciao xardas008
I’m not a guru, but had the same problem. I almost solved it with something like the following:
- Rectangle {
- id: lineEdit
- property alias text: input.text
- [...]
- TextInput {
- id: input
- text: "text here"
- [...]
- }
- MouseArea {
- anchors.fill: parent
- onClicked: {
- input.focus = true
- input.openSoftwareInputPanel();
- }
- }
- Keys.onReturnPressed: {
- lineEdit.focus = true
- input.closeSoftwareInputPanel();
- }
- Keys.onEnterPressed: {
- lineEdit.focus = true
- input.closeSoftwareInputPanel();
- }
- }
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
You must log in to post a reply. Not a member yet? Register here!
