Results 1 to 4 of 4

Thread: QRegExp?

  1. #1
    Join Date
    Aug 2006
    Posts
    6
    Thanks
    3
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Question QRegExp?

    Hi,

    how can i set a range (0.24 – 2.06) to a QLineEdit with a QRegExp?

    I try this

    Qt Code:
    1. QRegExp regExpRange("(?:[0-2]24)(?:[.,]\\d\\d?)?|2(?:[.,]06?)?"); //Range 0.25 – 2.05
    2. myQLineEdit->setValidator(new QRegExpValidator(regExpRange, this));
    To copy to clipboard, switch view to plain text mode 

    Thanks in advance

    Marco812

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QRegExp?

    Try:
    Qt Code:
    1. "0[.,]2[4-9]|0[.,][3-9]\\d|1[.,]\\d\\d|2.0[0-6]"
    To copy to clipboard, switch view to plain text mode 
    but maybe QDoubleSpinBox will be more usefull? There is also QDoubleValidator.

  3. The following user says thank you to jacek for this useful post:

    Marco812 (3rd August 2006)

  4. #3
    Join Date
    Aug 2006
    Posts
    6
    Thanks
    3
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Question Re: QRegExp?

    Hi,

    thank you for the tip, but i think in this case is better to use QRegExp as a QDoubleValidator. Your QRegExp is OK, thank you.

    Greetings

    Marco812

  5. #4
    Join Date
    Aug 2006
    Posts
    6
    Thanks
    3
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Question Re: QRegExp?

    Hi,

    sorry i have found an error. I can put values like "2100" or "23" or "24".... I think that's OK:

    Qt Code:
    1. "0[.,]2[4-9]|0[.,][3-9]\\d|1[.,]\\d\\d|2[.,]0[0-6]"
    To copy to clipboard, switch view to plain text mode 

    Greetings,

    Marco812
    Last edited by Marco812; 4th August 2006 at 08:39.

Similar Threads

  1. QRegExp Help; remove all html tag
    By patrik08 in forum Qt Programming
    Replies: 7
    Last Post: 27th July 2006, 13:40
  2. Extract method on plaintext with QRegExp
    By jlbrd in forum Qt Programming
    Replies: 1
    Last Post: 2nd July 2006, 13:38
  3. need help for my QRegExp
    By patcito in forum Qt Programming
    Replies: 1
    Last Post: 27th May 2006, 16:29
  4. Trouble parsing using simple QRegExp
    By johnny_sparx in forum Qt Programming
    Replies: 4
    Last Post: 24th February 2006, 00:42
  5. IP adresses with QRegExp (Qt3)
    By jlbrd in forum Qt Programming
    Replies: 3
    Last Post: 31st January 2006, 13:43

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.