Results 1 to 4 of 4

Thread: Mask with validation

  1. #1

    Default Mask with validation

    This code doesn't work in Qt5.5

    QString latMask = "([0-8][0-9]|90)" ;
    QRegExp rLat(latMask + latMask);
    ui.lineEdit->setValidator(new QRegExpValidator(rLat));
    ui.lineEdit->setInputMask(QString::fromLatin1("00°00"));

  2. #2
    Join Date
    Dec 2009
    Location
    New Orleans, Louisiana
    Posts
    791
    Thanks
    13
    Thanked 153 Times in 150 Posts
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Re: Mask with validation

    What doesn't work exactly? For starters, I doubt your regex does what you think it does and secondly, your input mask seems to be invalid. Haven't used myself, but the input mask characters supported are here.

    Why don't you show an example of what you consider valid input in the QLineEdit and any restrictions you want for that input data, etc.
    I write the best type of code possible, code that I want to write, not code that someone tells me to write!

  3. #3

    Default Re: Mask with validation

    Only the mask works, but the validation doesn't works

  4. #4
    Join Date
    Dec 2009
    Location
    New Orleans, Louisiana
    Posts
    791
    Thanks
    13
    Thanked 153 Times in 150 Posts
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Re: Mask with validation

    I'm afraid I can't help you if you don't provide the info I requested in my prior post. I'm sure your regex is not doing what you think it's doing, but without understanding what you consider valid input, I can't help.
    I write the best type of code possible, code that I want to write, not code that someone tells me to write!

Similar Threads

  1. set the validation for checkboxes
    By sangee in forum Qt Programming
    Replies: 10
    Last Post: 24th August 2012, 09:45
  2. How to set the validation for checkboxes?
    By sangee in forum Qt Programming
    Replies: 1
    Last Post: 10th August 2012, 07:59
  3. XML Validation
    By NoRulez in forum Qt Programming
    Replies: 4
    Last Post: 15th September 2010, 13:07
  4. Validation
    By Tavit in forum Qt Programming
    Replies: 2
    Last Post: 21st March 2009, 07:03
  5. Problem with mask and validation
    By gunhelstr in forum Qt Programming
    Replies: 1
    Last Post: 19th April 2006, 08:07

Tags for this Thread

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.