Results 1 to 1 of 1

Thread: IPAddress Validator RegExp

  1. #1
    Join Date
    Jan 2007
    Posts
    92
    Thanks
    14
    Thanked 1 Time in 1 Post

    Default IPAddress Validator RegExp

    Guys,

    I have a little problem with regular expression validators. If I used below mentioned pIPAddressValidator for lineEdit1 or lineEdit2 it disables paste function upon right click action or CLT+V keyboard action. To make copy and paste function to work ..I have to acutally modify something in the lineEdit. From this case...The lineEdits on the dialog will be pre-populated with some IPAddresses. What if I just want to copy the text from lineEdit1 to lineEdit2 without modify or existing text...validator does not allow me to paste . I have tested removing setValidator(pIPAddressValidator) statement from my code then copy or paste works fine without any problem. Actually in right click menu copy or paste is enabled..it is just does not allow me to paste the selected text. But if I just click and modify a one digit the lineEdit..then paste works fine.
    Qt Code:
    1. QString Octet = "(?:[0-1]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])";
    2.  
    3. QRegExp rx("^" + Octet + "\\." + Octet + "\\." + Octet + "\\." + Octet + "$");
    4.  
    5. pIPAddressValidator = new QRegExpValidator( rx, this );
    6.  
    7. lineEdit1->setValidator(pIPAddressValidator);
    8. lineEdit2->setValidator(pIPAddressValidator);
    To copy to clipboard, switch view to plain text mode 


    I have using linux platform with Qt3. Is there something wrong with RegExp that I have been using but it validates Ip address fine.
    Last edited by user_mail07; 3rd April 2008 at 03:37. Reason: missing [code] tags

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.