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. Text Masking in TextField
Qt 6.11 is out! See what's new in the release blog

Text Masking in TextField

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 2 Posters 614 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
    Veeresh Veer
    wrote on last edited by
    #1

    Without key event can i do passwordmaskdelay for Text? and Is there chance of generating key event without using keyboard keys manually???
    I tried by using passwordmaskdelay property ,it is not working for my code because i'm using the customized button.

    TextField {
        id: inputtext
        color: "red"
        width:300;height:100
        anchors.centerIn: parent
        echoMode: TextInput.Password
        passwordMaskDelay: 3000
        horizontalAlignment: TextInput.Center
    }
    Button{
        id:btn
        height:100
        width: 100
        text: "1"
        onClicked:{
            console.log("button clicked  = "+btn.text)
            inputtext.text+=btn.text
        }
    }
    
    1 Reply Last reply
    0
    • N Offline
      N Offline
      NYBL
      wrote on last edited by NYBL
      #2

      use insert function of TextField

      import QtQuick 2.12
      import QtQuick.Controls 2.14
      
      Rectangle {
          anchors.fill: parent;
          //I added this button
          TextField {
              id: inputtext
              color: "red"
              width:300;height:100
              anchors.centerIn: parent
              echoMode: TextInput.Password
              passwordMaskDelay: 3000
              horizontalAlignment: TextInput.Center
          }
          Button {
              id:btn
              height:100
              width: 100
              text: "1"
              onClicked: {
                  console.log("button clicked  = "+btn.text)
                  inputtext.insert(inputtext.length ,btn.text)
              }
          }
      }
      
      V 1 Reply Last reply
      2
      • N NYBL

        use insert function of TextField

        import QtQuick 2.12
        import QtQuick.Controls 2.14
        
        Rectangle {
            anchors.fill: parent;
            //I added this button
            TextField {
                id: inputtext
                color: "red"
                width:300;height:100
                anchors.centerIn: parent
                echoMode: TextInput.Password
                passwordMaskDelay: 3000
                horizontalAlignment: TextInput.Center
            }
            Button {
                id:btn
                height:100
                width: 100
                text: "1"
                onClicked: {
                    console.log("button clicked  = "+btn.text)
                    inputtext.insert(inputtext.length ,btn.text)
                }
            }
        }
        
        V Offline
        V Offline
        Veeresh Veer
        wrote on last edited by
        #3

        @NYBL Thanks for the information

        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