Qt Virtual Keyboard and TextInput



  • Hi all,

    since the virtual keyboard has no ESC key or the like to cancel editing in a TextInput I tried to use the Qt.inputMethod.visible property to detect when a user closes the virtual keyboard without pressing the return key before. But unfortunately this signal gets emitted before the accept signal. So there's no way to differ a cancel from an accept by catching the Qt.inputMethod.visibleChanged signal.

    TextInput {
      id: textInput
      onAccepted: console.log("accepted")
    
      Connections {
        target: Qt.inputMethod
        onVisibleChanged: {
          console.log("inputMethodVisibleChanged:", target.visible)
        }
      }
    }
    

    Output:

    qml: inputMethodVisibleChanged: false
    qml: accepted
    

    Is there any other way to implement an editing canceled event?

    Regards


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.