Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to highlight the TextField which has no text ?

How to highlight the TextField which has no text ?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 2 Posters 860 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    divaindie
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      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.

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      1
      • D Offline
        D Offline
        divaindie
        wrote on last edited by divaindie
        #3

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

        1 Reply Last reply
        0
        • dheerendraD Offline
          dheerendraD Offline
          dheerendra
          Qt Champions 2022
          wrote on last edited by
          #4

          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.

          Dheerendra
          @Community Service
          Certified Qt Specialist
          http://www.pthinks.com

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved