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 not shown when setting inputMask

TextField placeholderText not shown when setting inputMask

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 2 Posters 1.7k Views 1 Watching
  • 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.
  • M Offline
    M Offline
    Mr Pang
    wrote on last edited by
    #1

    Hi,
    I have just found that if I set inputMask property ,placeholderText is not shown.
    placeholderText: qsTr("input your key here.")
    inputMask: "99999"

    What is the problem?

    1 Reply Last reply
    1
    • CharbyC Offline
      CharbyC Offline
      Charby
      wrote on last edited by
      #2

      It seems the placeHolderText is conflicting with the inputMast.
      I never encountered this problem as I always use a home made text input with a dedicated Text qml item for the placeholder.

      If you want to stick with TextField, you think this work-around could match your need...

      TextField{
              placeholderText: qsTr("input your key here.")
              onActiveFocusChanged:{
                  inputMask="99999"
          }
      
      M 1 Reply Last reply
      1
      • CharbyC Charby

        It seems the placeHolderText is conflicting with the inputMast.
        I never encountered this problem as I always use a home made text input with a dedicated Text qml item for the placeholder.

        If you want to stick with TextField, you think this work-around could match your need...

        TextField{
                placeholderText: qsTr("input your key here.")
                onActiveFocusChanged:{
                    inputMask="99999"
            }
        
        M Offline
        M Offline
        Mr Pang
        wrote on last edited by
        #3

        @Charby
        But I have set "Component.onCompleted: textfield.forceActiveFocus()" in parent compoment.

        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