Results 1 to 6 of 6

Thread: TextField With Validator and echoMode Set to TextInput Password

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2015
    Posts
    20
    Thanks
    1
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default TextField With Validator and echoMode Set to TextInput Password

    I'm having issue using both TextField with echoMode set to TextInput.Password and a validator. I'm unable to type into either the index 4 or 5 box! So my regex is either wrong but works in a calculator or somethings up with echoMode.

    Qt Code:
    1. TextTield {
    2. id: rowField
    3. echoMode: index===4 || index===5 ? TextInput.Password : TextInput.Normal
    4. text: modeltext
    5. valFail: ((!acceptableInput && focus) ? true : false)
    6. property var valid0: RegExpValidator { regExp: /.*/ }
    7. property var valid1: RegExpValidator { regExp: /.*/ }
    8. property var valid2: RegExpValidator { regExp: /^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$/ }
    9. property var valid3: RegExpValidator { regExp: /.{6,}/ }
    10. property var valid4: RegExpValidator { regExp: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[a-zA-Z\d@$!%*?&]{8,32}$/ }
    11. property var valid5: RegExpValidator { regExp: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[a-zA-Z\d@$!%*?&]{8,32}$/ }
    12. property var valid6: RegExpValidator { regExp: /.*/ }
    13. validator:
    14. if(index === 1) {valid1}
    15. else if(index === 2) {valid2}
    16. else if(index === 3) {valid3}
    17. else if(index === 4) {valid4}
    18. else if(index === 5) {valid5}
    19. else if(index === 6) {valid6}
    20. else{valid0}
    To copy to clipboard, switch view to plain text mode 


    Any insight appreciated!

    Thanks,
    -Rich

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: TextField With Validator and echoMode Set to TextInput Password

    If you don't put any validator on those fields, are you able to type into them?
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. #3
    Join Date
    Apr 2015
    Posts
    20
    Thanks
    1
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: TextField With Validator and echoMode Set to TextInput Password

    Did not try that but I can type and see '*' in the field with / ^.*$ / as the validator regex.

  4. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: TextField With Validator and echoMode Set to TextInput Password

    I'm wondering whether the validator is acting on the text you type or the "***" it is getting replaced with. If you go back to your original regex and turn off the password flag, does it work then?
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Replies: 1
    Last Post: 13th May 2019, 16:25
  2. Replies: 0
    Last Post: 22nd September 2016, 21:23
  3. TextField Completer
    By folibis in forum Qt Quick
    Replies: 1
    Last Post: 23rd December 2013, 12:44
  4. How can i have echomode in QtableView for password column?
    By WinterIsComing in forum Qt Programming
    Replies: 2
    Last Post: 11th July 2013, 10:09
  5. QLineEdit and EchoMode Passowrd
    By high_flyer in forum Qt Programming
    Replies: 3
    Last Post: 1st April 2009, 17:34

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.