Search code examples
qtqmlqtquickcontrols2

TextField "rejected" signal?


It has accepted signal. But I don't see rejected signal (i.e. user pressed Esc key) anywhere.

Am I missing something? If not, is there some workaround?

Qt 5.11, Quick Controls 2.


Solution

  • If your goal is only to detect if the Escape key is pressed then use Keys.

    TextInput {
        text: "Text"
        onAccepted: console.log("accepted")
        Keys.onEscapePressed: console.log("escaped")
    }