Results 1 to 4 of 4

Thread: Masking QLineEdit to accept white space.

  1. #1
    Join Date
    May 2010
    Posts
    100
    Thanks
    1
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Masking QLineEdit to accept white space.

    Hi, All,

    I Have problem related to QLineEdit.

    I am using 2 QLineEditne is User ID and Another is User Name.
    I want to allow only digits 0-9 in User Id, and a-z,A-Z,0-9,and white space in User Name.

    I have masked User Id with "000000" to accept only 6 digits.And works fine.
    But, how can i mask User Name to allow a-z,A-Z,0-9,and white space in User Name.

    how can i do this?

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Masking QLineEdit to accept white space.

    I want to allow only digits 0-9
    Just use a QIntValidator.

    and a-z,A-Z,0-9,and white space in User Name.
    Use a QRegExpValidator
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    May 2010
    Posts
    100
    Thanks
    1
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Masking QLineEdit to accept white space.

    Thanks For this,

    But i need to check the Validation every time some thing entered into the LineEdit Box.
    And see if it returns a valid OR invalid.

    cant it be automatic? Like if i mask User Id with "000000", Than i didnt have to check Any thing.It will just accepts Digits 0 to 9.

    And i mask user name with "nnnnnnnnnnnnn", but this is not accepting white space.What should i Do?

  4. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Masking QLineEdit to accept white space.

    The validation I suggested ARE automatic, and do exactly what you want.
    Read their documentation.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. Dynamic masking...?
    By lar0che in forum Newbie
    Replies: 1
    Last Post: 16th August 2010, 07:23
  2. Replies: 1
    Last Post: 26th July 2009, 15:08
  3. Intense Masking....
    By been_1990 in forum Qt Programming
    Replies: 20
    Last Post: 30th April 2009, 16:03
  4. Masking password
    By Lebowski in forum Qt Tools
    Replies: 3
    Last Post: 14th April 2006, 11:17
  5. linking user space and kernel space programs with qmake
    By zielchri in forum Qt Programming
    Replies: 9
    Last Post: 8th March 2006, 23:11

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
  •  
Qt is a trademark of The Qt Company.