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. TextField placeholderText - Trying to capture numeric input. Would like underscores for digit fields. QML 5.15
Forum Update on Monday, May 27th 2025

TextField placeholderText - Trying to capture numeric input. Would like underscores for digit fields. QML 5.15

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 3 Posters 480 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.
  • V Offline
    V Offline
    VFCraig
    wrote on 1 Feb 2022, 16:18 last edited by
    #1

    Why does this still appear to be broken after at least 5 years? (Looking at previous posts on this and other sites.)

    If I set a placeholder text, I should be able to make it whatever I please, possibly with some auto-fill options. And underscores would be a naturally acceptable option for numeric digits until they are entered.

    OK, so I have set the input to accept only numeric characters, but I do plan to use the same field for values with decimal points at varying locations, a variable number of digits and possibly no decimal point. Yes, I should be able to easily do this without setting a Double vs an Int validator.

    And, yes, this is why placeholderText has value for numeric input.

    I entered underscores and that didn't work. So I entered zeros where the underscores would go. Still NOTHING! I can enter zeros in the fields and generate a string that is identical to the placeholderText I entered, but even the zeros show NOTHING when used for placeholderText.

    Please fix this. Granted, it won't be fixed in time for me to use it on this project, but please fix this.

    1 Reply Last reply
    0
    • F Offline
      F Offline
      fcarney
      wrote on 1 Feb 2022, 19:05 last edited by
      #2

      Are you wanting the placeholder text to appear while you are entering in text?
      The docs specify "before" you enter text. Meaning there is nothing in the field yet.

      You could achieve this by putting a Text {} behind the TextField and tracking what has been entered into the field and changing the text in the Text Item. This might be tricky though. Is TextField background opaque? Might have to customize the control a bit.

      C++ is a perfectly valid school of magic.

      1 Reply Last reply
      0
      • G Offline
        G Offline
        GrecKo
        Qt Champions 2018
        wrote on 1 Feb 2022, 19:15 last edited by
        #3

        What have you tried? Can you share a reproducible example?
        Please share details so we can help you.

        Because when I tried to reproduce what I understood from your post, it "works on my system":
        24a74e21-eb8a-42f3-bcdb-ff40da5f3491-image.png

        1 Reply Last reply
        0

        1/3

        1 Feb 2022, 16:18

        • Login

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