Results 1 to 1 of 1

Thread: Regular expression

  1. #1
    Join Date
    Jan 2013
    Posts
    43
    Thanks
    27
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Regular expression

    In a Qt designer Form Class e have this lines in the constructor:
    Qt Code:
    1. rx = new QRegExp("[0-9]{1,3}");
    2. ui->lineEdit->setValidator(new QRegExpValidator (*rx, this));
    To copy to clipboard, switch view to plain text mode 

    Can i manage this same effect in a single line?

    In a Qt designer Form Class e have this lines in the constructor:
    Qt Code:
    1. rx = new QRegExp("[0-9]{1,3}");
    2. ui->lineEdit->setValidator(new QRegExpValidator (*rx, this));
    To copy to clipboard, switch view to plain text mode 

    Can i manage this same effect in a single line?


    Added after 4 minutes:


    ops...
    Qt Code:
    1. ui->lineEdit->setValidator(new QRegExpValidator (QRegExp("[0-9]{1,3}"), this));
    To copy to clipboard, switch view to plain text mode 
    Last edited by aguleo; 25th January 2013 at 14:59.

Similar Threads

  1. Regular expression
    By QFreeCamellia in forum Newbie
    Replies: 8
    Last Post: 30th December 2011, 22:34
  2. Regular expression help!
    By ConkerX in forum Qt Programming
    Replies: 10
    Last Post: 31st August 2011, 15:47
  3. Help with regular expression
    By Gourmet in forum General Programming
    Replies: 19
    Last Post: 11th August 2011, 15:04
  4. Regular Expression Problem
    By kaushal_gaurav in forum Qt Programming
    Replies: 2
    Last Post: 27th February 2009, 09:41
  5. set a regular expression on QTextEdit
    By mattia in forum Newbie
    Replies: 3
    Last Post: 27th March 2008, 10:16

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.