Important: Please read the Qt Code of Conduct -

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)


    qml: inputMethodVisibleChanged: false
    qml: accepted

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


Log in to reply