Haroun Hajem
Haroun Hajem

Reputation: 5628

TextInput documentation don't specify onTextChanged signal

I can subscribe to the signal TextChanged in my QML code. But however i don't seem to find it in the documentation. I've searched the inherited ascending classes as well, none of them specify it. Have I missed something or is the documentation wrong?

I'm running QtQuick 2.15 and looking in the documentation for QtQuick 2.15 TextInput QML Type

TextInput {
    id: firstNameInput        
    onTextChanged: {
        console.log("First name: " + text)
        }
}

Upvotes: 0

Views: 2811

Answers (2)

girish
girish

Reputation: 1

TextField {
  id: textField

  onTextChanged: {
   console.log("Entered Text is Here == " + textField.text)
  }
}

It will execute each time when text is changed.
In this "textField.text" you will get the entered text.

Upvotes: 0

Haroun Hajem
Haroun Hajem

Reputation: 5628

I found the problem I've forgot that all the properties are assigned with handlers in QT.

import QtQuick 2.15

TextInput {
    // Property 
    text: "Change this!"
    // Signal handler
    onTextChanged: console.log("Text has changed to:", text)
}

Upvotes: 1

Related Questions