Results 1 to 5 of 5

Thread: How many validators can be applied to a single QLineEdit?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2008
    Location
    Glenwood, NJ USA
    Posts
    32
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default How many validators can be applied to a single QLineEdit?

    I have a QLineEdit in a dialog box I am creating that allows entering an IP address. I have used a QRegExp validator to ensure that it takes the form:

    "[0-2][0-9][0-9][.][0-2][0-9][0-9][.][0-2][0-9][0-9][.][0-2][0-9][0-9]"

    (I know I need some improvement with regular expressions...)

    This works ok but I still need to range check so each of the four values are within 0-255.

    Can multiple validators be applied to the same widget?

    Or, am I going about this all wrong?

    I was thinking it might be better to break down the QLineEdit into four separate ones, use the range checking of a QIntValidator and then convert to one single QString after it is valid?
    Last edited by awhite1159; 12th July 2008 at 14:04.

Similar Threads

  1. Pointer Question related to QLineEdit
    By ChrisReath in forum Qt Programming
    Replies: 1
    Last Post: 23rd May 2008, 15:13
  2. KDE/QWT doubt on debian sarge
    By hildebrand in forum KDE Forum
    Replies: 13
    Last Post: 25th April 2007, 06:13

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
  •  
Qt is a trademark of The Qt Company.