Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Virtual keyboard doesn't open although it exists when focusing TextInput or TextEdit elements.
Forum Updated to NodeBB v4.3 + New Features

Virtual keyboard doesn't open although it exists when focusing TextInput or TextEdit elements.

Scheduled Pinned Locked Moved QML and Qt Quick
5 Posts 2 Posters 3.0k 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.
  • X Offline
    X Offline
    xardas008
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • U Offline
      U Offline
      ultimodruido
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • X Offline
        X Offline
        xardas008
        wrote on last edited by
        #3

        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?

        1 Reply Last reply
        0
        • U Offline
          U Offline
          ultimodruido
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          • X Offline
            X Offline
            xardas008
            wrote on last edited by
            #5

            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?

            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