How to highlight the TextField which has no text ?

  • Hi All,

    in my qml application i have few textfields which takes user inputs like name,age,hobbies etc.suppose if user missed to enter any textfield, my application should highlight those fields which doesn't contain any text .how can i achieve this?any textfield property is there to do it?

  • Qt Champions 2017

    There is nothing specific. Just check the empty string value using text property of TextField. If it is empty string, then put rectangle highlighter around the text field.

  • i need to assign a rectangle object to 'highlight' property right ?
    AFAIK textfield dont have highlight property !!

  • Qt Champions 2017

    You are right. There is no highlight property. Please note that highlighting the fields which don't have any values is our logic. We can make the component with TextField wrapped around in Rectangle. Highlight it whenever required.

Log in to reply