Results 1 to 6 of 6

Thread: Validator

  1. #1
    Join Date
    Apr 2010
    Location
    Sudan
    Posts
    46
    Thanks
    7
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Question Validator

    hi every one

    i want to make a validator for all letters and digits BUT ( ' ) and set maximum input to 10 .

    PS.
    the input letter could be Arabic.

    regards

  2. #2
    Join Date
    Jul 2010
    Location
    Indonesia
    Posts
    83
    Thanked 17 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Default Re: Validator

    See QRegExpValidator documentation.
    ~ We are nothing in this universe ~

  3. #3
    Join Date
    Apr 2010
    Location
    Sudan
    Posts
    46
    Thanks
    7
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Validator

    i tried to do it from the documentation but i didn't find what i need.

    i just want to block the ' form being written and make maximum number of letter to be 10.

  4. #4
    Join Date
    Jul 2010
    Location
    Indonesia
    Posts
    83
    Thanked 17 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Default Re: Validator

    To set max input, if you are using QLineEdit, use setMaLength(10).
    set the validator with QRegExpValidator and the pattern would be look like "[^']" means doesn't accept single quote.
    Try to create your own code.
    ~ We are nothing in this universe ~

  5. The following user says thank you to viulskiez for this useful post:

    tinysoft (13th April 2011)

  6. #5
    Join Date
    Apr 2010
    Location
    Sudan
    Posts
    46
    Thanks
    7
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Validator

    i wrote it this way "[^']{1,10}" and it worked fine.

    thank you for your support.

  7. #6
    Join Date
    Jul 2010
    Location
    Indonesia
    Posts
    83
    Thanked 17 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Default Re: Validator

    Well, that's similar. You are smart!
    ~ We are nothing in this universe ~

Similar Threads

  1. validator on line edit
    By Raul in forum Qt Programming
    Replies: 4
    Last Post: 27th August 2010, 04:18
  2. Validator for QTableView columns
    By sasi in forum Qt Programming
    Replies: 0
    Last Post: 6th October 2009, 08:10
  3. Validator for QDoubleSpinBox
    By ehamberg in forum Qt Programming
    Replies: 3
    Last Post: 15th March 2008, 11:37
  4. QRegExp validator
    By mattia in forum Newbie
    Replies: 2
    Last Post: 28th November 2007, 08:15
  5. what's wrong with my validator?
    By TheKedge in forum Qt Programming
    Replies: 5
    Last Post: 26th January 2006, 21:41

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.