Results 1 to 3 of 3

Thread: QIntValidator

  1. #1
    Join Date
    Jan 2007
    Posts
    26
    Thanks
    10
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QIntValidator

    Im trying to set a valid range for a line edit. The maximum value is being enforced, but the minimum value is not. i.e. it is allowing values less then 10 to be entered and stored.

    How can I get the minimum value to be enfored?

    Qt Code:
    1. QValidator *trackLineEditValidator = new QIntValidator(10, 255, this);
    2. ui.trackLineEdit->setValidator(trackLineEditValidator);
    To copy to clipboard, switch view to plain text mode 

    Thank you,
    Chas

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QIntValidator

    Wouldn't spinbox be a better choice for that kind of numerical input?
    J-P Nurmi

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

    ChasW (12th February 2007)

  4. #3
    Join Date
    Jan 2007
    Posts
    26
    Thanks
    10
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QIntValidator

    Absolutely!

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.